To fire the checkchange you need to have the node and if it's checked.
The TreePanel
is using Ext.data.TreeStore
to store it's nodes information (it is in the store
property).
This TreeStore has the getNodeById( id )
method which returns the record node by id.
If you want to get the node from another property, then you need to use the tree
(Ext.data.Tree
) property from store
, which is like a node manager. This has a node record array in the nodeHash
property. You need to iterate this Array and compare the given property manually.
The complete code:
buttonClick: function(button, e, eOpts) {
var treepanel = button.up(...).down('treepanel');
var node = treepanel.getStore().getNodeById(yourIDHere);
// for custom property use this:
/*var nodeHash = treepanel.getStore().tree.nodeHash;
var node;
for (var x in nodeHash) {
if (nodeHash[x].get('customProperty') == customValue) {
node = nodeHash[x];
break;
}
} */
treepanel.fireEvent('checkchange', node, node.get('checked'));
}