I use the MVC-architecture in Extjs application. I have a simply button, it looks like a:
{
xtype: 'button',
id: 'searchButton',
margin: '5 0',
text: 'Search'
}
And how I can press it button programmatically from this view?
I use the MVC-architecture in Extjs application. I have a simply button, it looks like a:
{
xtype: 'button',
id: 'searchButton',
margin: '5 0',
text: 'Search'
}
And how I can press it button programmatically from this view?
Share Improve this question edited Jan 15, 2014 at 10:11 user3197236 asked Jan 15, 2014 at 8:24 user3197236user3197236 331 silver badge4 bronze badges 04 Answers
Reset to default 6I think imitate button-click from view it is a not good solution. If you use a MVC-architecture you may do it from Controller. And you may fire events, because your solution is bad way. But if you still want do it, this code I think will be helpful for you:
Ext.get('searchButton').dom.click();
And please read this article in official site EXTjs MVC-architecture
I made the same thing using this:
var ele = Ext.getCmp("searchButton");
ele.fireEvent('click');
For ExtJs 3.0 / 3.4 you can use
Ext.getCmp("searchButton").el.dom.click()
.el.dom return the actual HTML object for every ExtJs object... so once you reach el.dom now you are doing normal JavaScript... this applies nearly to all ExtJs elements.
in controller get the reference for the element just and call click() :
var me = this;
var refs = me.getReferences();
var save = refs.save_button;
save.click();