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

A simple example code of Ext.XTemplate_extjs

WBOY
WBOYOriginal
2016-05-16 17:55:061404browse

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);
}
}
);

Statement:
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