Foreword
Keywords: ExtJs 3.1 XmlTreeLoader Example Error, XmlTreeLoader error, TreePanel Error
I have been struggling with the XmlTreeLoader example of ExtJs 3.1 for nearly an afternoon and night. The official example has no problem and can load xml data. The local IIS is dead and does not report an error. Directly checking the official code is exactly the same. I accidentally searched it this morning. It was not found in the official website, but in what looked like a Korean blog. As a tribute, this article will be a simple Chinese "translation".
Original text
http://javarush.com/entry/ExtJS-XmlTreeLoader-Error
Text
1. Code location: Ext3.1examplestreexml-tree-loader.js
2. Pay attention to the new code marked in red ", requestMethod: 'GET'"!!
Published: {published}
',< ;b>Synopsis: {innerText}
',Purchase from Amazon'
);
tpl.compile();
new Ext.Panel({
title: 'Reading List',
renderTo: 'tree ',
layout: 'border',
width: 500,
height: 500,
items: [{
xtype: 'treepanel',
id: 'tree-panel ',
region: 'center',
margins: '2 2 0 2',
autoScroll: true,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode() ,
// Our custom TreeLoader:
loader: new Ext.app.BookLoader({
dataUrl:'xml-tree-data.xml'
,requestMethod: 'GET'
}),
listeners: {
'render': function(tp){
tp.getSelectionModel().on('selectionchange', function(tree, node){
var el = Ext.getCmp('details-panel').body;
if(node && node.leaf){
tpl.overwrite(el, node.attributes);
}else{
el.update(detailsText);
}
})
}
}
},{
region: 'south',
title: 'Book Details' ,
id: 'details-panel',
autoScroll: true,
collapsible: true,
split: true,
margins: '0 2 2 2',
cmargins: '2 2 2 2',
height: 220,
html: detailsText
}]
});
});