javascript - Synching check change event for two TreePanel in EXTJS 4.1 -
i have 2 extjs treepanel. 1 tree loaded (call fltree) , second 1 partially loaded (call pl tree). when user clicks on node in loaded tree & node present in partially loaded tree, want fire checkchange event node in partially loaded tree.
is possible?
yes, ext.tree.panel
has itemclick
event fired when item clicked (you need add in controller or in treepanel's listeners property. attributes are:
somefunctionname: function(treeview, record, item, index, e, eopts) { ... }
record variable can data needed first tree's selected node. to find other treepanel can use up()
, down()
methods on treeview:
var parentcontainer = treeview.up('container_xtype[someproperty1=somevalue1]');
you can walk in component hierarchy (get parent container contains both treepanels).
var pltree = parentcontainer.down('treepanel[someproperty2=somevalue2]');
if 2 treepanel doesn't have common parent, can use
var pltree = ext.componentquery.query('treepanel[someproperty2=somevalue2]')[0];
global method returns array of matched components. but make sure use component selector query (you can check if returned array's length == 1). finally need use pltree.fireevent('checkchange', ...);
described here.
Comments
Post a Comment