I define a treepanel extend extend: 'Ext.tree.Panel' and that has initComponent function like
Ext.define('Example', {
extend: 'Ext.tree.Panel',
title: 'Example',
useArrows:false,
rootVisible: false,
border: false,
initComponent: function () {
var store = Ext.create('Ext.data.TreeStore', {
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'}
],
autoLoad : false, // not working
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'results'
}
}
});
this.store = store;
this.callParent(arguments);
}
});
I try to set autoLoad: false but that always loading when i create my treepanel
When i try to config below code to store then autoLoad: false working but my treepanel after load is blank
root: {
text: 'Ext JS',
id: 'src',
expanded: false // this
}
my json is good and working if not using root config like
({ "results": [
{
id : '1' ,
text : '1',
expanded: true,
results :[{
id : '2' ,
text : '2',
leaf:true
}]
},{
id : '3' ,
text : '3',
leaf:true
}]
})
How to fix that thanks.
beforeloadevent and return false if it is notvalid- sravalid, what do u mean? But why my code fails,autoLoad : falseis not working :( - DeLetruethe store will load after it is created. Create just the store without the treepanel and you will see that your store don't load after creation. - srabeforeloadi think that's hard to catch. i usingroot: { results: [] }instorethenautoLoad: falseworking but when iload()mytreepanelis blank? - DeLe