Tuesday, April 5, 2016

TreeStore: different behaviour beetween autoLoad configuration and load() function

Leave a Comment

The test case in fiddle is working with autoLoad: true but with autoLoad: false (line 86) the load() function called at line 161 in the TreePanel beforerender event does not load the data...

For (non tree) panels I allways have set autoLoad to false and load the store on render of the GridPanel and it works perfectly. I do it like this to prevent loading all the stores at the beginning (and to set filters sometimes).
The beforeload event of the store is preventing double-load.

Where is my fault for this TreeStore ? I am looking for a solution for a long time without any result...

1 Answers

Answers 1

I think I've solved your problem.

Use the root property for your TreeStore.

/*  * Store  */ Ext.define('Chronos.store.Clockings', {     extend  : 'Ext.data.TreeStore',     requires: [         //'Chronos.store.Session'     ],     model       : 'Chronos.model.Presence',     autoLoad    : false, //true, // false,     //autoSync    : true, // DEBUG     sortOnLoad  : false,     pageSize    : 0,     remoteFilter: true,      root: {        id: 'id',        expanded: true     },      listeners: {         load: function(treestore, records, success) {             console.log(Date(), 'clockings loaded: ', success, treestore);         },         beforeload: function (treestore) {                         if(treestore.isLoading()) return false;                 }     } }); 

Hope this is what you are looking for!

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment