View Full Version : Pass store values on Tree expand

3 Jan 2012, 11:20 AM
I am trying to create a tree that loads data dynamically via proxy from a Java servlet. When a tree node is expanded I need to pass data from multiple columns (in blue below) in the tree store's model back to the servrlet in the form of HTTP request parameters (similar to how the standard "node" parameter is passed). This data is potentially different for each node in the tree so a blanket "extraParams" definition does not seem to work?

extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'string' },
{ name: 'text', type: 'string' },
{ name: 'currId', type: 'string' },
{ name: 'currType', type: 'string' },
{ name: 'parId', type: 'string' },
{ name: 'treeId', type: 'string' },
{ name: 'params', type: 'string' }

Thanks in advance for the help.


6 Jan 2012, 12:47 PM
Here is the solution I found. Hopefully it will help someone else? I put a listener in the tree that pulls values from the store creates "extraParms" for them dynamically when the node is expanded. It's not perfect but it seems to get the job done.

beforeitemexpand: function (node, eventObj)
this.store.proxy.extraParams['nodeId'] = node.data.nodeId;
this.store.proxy.extraParams['nodeType'] = node.data.nodeType;
this.store.proxy.extraParams['nodeTreeId'] = node.data.nodeTreeId;
this.store.proxy.extraParams['nodeParId'] = node.data.nodeParId;
this.store.proxy.extraParams['nodeActionId'] = node.data.nodeActionId;
this.store.proxy.extraParams['nodeParams'] = node.data.nodeParams;