Home > Web Front-end > JS Tutorial > A simple example code of Ext.XTemplate_extjs

A simple example code of Ext.XTemplate_extjs

WBOY
Release: 2016-05-16 17:55:06
Original
1386 people have browsed it

Output provinces and cities in the form of trees

Copy the code The code is as follows:

Ext.lib .Ajax.request(
'POST',
'/Index/mainIndex',
{ success: function (data) {
data.responseText = "{pros:" data.responseText "} "; //Get the province and city JSON format data of the background callback
var response = Ext.util.JSON.decode(data.responseText);
var province = new Ext.XTemplate(
'',//Traverse and read pros
'

{id}--{text}

',
'',//Traverse and read the children under pros
'

{id}--{text}

',
'
',
'
'
);
province.compile();
province.append("Div2", response);
}
}
);

Related labels:
ext
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template