PDA

View Full Version : TreePanel + DirectStore + directFn



levay
24 May 2010, 8:17 PM
Hello,

I have been searching for a couple of days trying to find what, at first glance, would appear to be an easy problem. I'm attempting to use an Ext.data.DirectStore to dynamically populate a TreePanel. DirectFn seems to be the way to go, but I can't find any solution that clearly explains what to do.

For example, how would I select which method could be used as the directFn?:



store_branch = new Ext.data.DirectStore({
api : {
read: Ext.ss['com.test.docs'].getTreeNode

},
directFn :{
getTreeNode : Ext.ss['com.test.docs'].getTreeNode
},
baseParams : 'elementType|branchid',
paramOrder : 'elementType|branchid',
paramsAsHash : true,
reader : new Ext.data.JsonReader({
fields : [
{ name: 'BRANCHNAME', type: 'string'},
{ name: 'BRANCHID', type: 'string'}
],
idProperty : 'BRANCHID',
root : 'ELEMENTS',
totalProperty : 'RECORDCOUNT'
}),
});
console.log(store_branch);

var treeLoader = new Ext.tree.TreeLoader({
directFn: store_branch.getTreeNode,
baseParams: {
elementType: 'branch',
branchid:''
},
paramOrder: ['elementType','branchid']
});




A console.log() shows that both getTreeNode and read are undefined. Can someone please provide a straightforward example of how to do this?

Thanks!

dontbugme
15 Feb 2011, 1:24 PM
WTF?