Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext.button click() method

Tags:

extjs

extjs4.1

ExtJS 4.1.

Is there something like Ext.button.click(); method on Ext.button class?

Is it possible to programmically "click" a button with one method?

like image 960
s.webbandit Avatar asked Aug 11 '12 11:08

s.webbandit


3 Answers

Or if you have an MVC structure you can fire the click event of the button, and if you're listening to the event in your controller and have an associated function it will get called.

button.fireEvent('click', button);
like image 114
Johan Haest Avatar answered Nov 14 '22 02:11

Johan Haest


The last answer on this forum might give you more insight on how you can do that here they are-

1)Create the event code in a function and call the function from both sides: btn.on("clic", ...) and from the code you want to simulate the click.

2)Use: btnView.btnEl.dom.click();

from - http://www.sencha.com/forum/showthread.php?37772-Solved-Programmatically-click-an-Ext.Button

like image 25
MimiEAM Avatar answered Nov 14 '22 02:11

MimiEAM


ExtJS 4.2.1

Ext.get('component-id-of-extjs-button').el.dom.click();
Ext.get('toggle-button2').el.dom.click();

works for me.

like image 6
yzorg Avatar answered Nov 14 '22 03:11

yzorg