PDA

View Full Version : Send click to tools button



mkrakowski
25 Apr 2013, 8:05 AM
I have a treepanel with an expand / collapse tool param. I would like to be able to fire this "collapse tool" button, with another button. Is this possible in Ext?

So far I have the following config on the "external" button.



listeners : {
click : function(button) {
var getSidenavTools = Ext.getCmp('tool-1013');
console.log(getSidenavTools); // Side nav collapse tool object
}
}


I'm not seeing anything within this object that would allow me to trigger a close.

Thanks!

slemmon
26 Apr 2013, 8:36 PM
You can do treePanel.collapse() / treePanel.expand().
http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.panel.Panel-method-collapse
http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.panel.Panel-method-expand

mkrakowski
27 Apr 2013, 3:12 PM
Excellent, Thank you!



click : function(button) {
var treePanel = Ext.getCmp('nav');
if (treePanel.collapsed == false) {treePanel.collapse(); }
[ ... ]
}