Joh*_*est 24
或者如果你有MVC结构,你可以触发按钮的click事件,如果你正在控制器中监听事件并且有一个相关的函数,它将被调用.
button.fireEvent('click', button);
Run Code Online (Sandbox Code Playgroud)
Mim*_*EAM 10
这个论坛的最后一个答案可能会让你更深入地了解如何在这里做到这一点 - 他们是 -
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();
Run Code Online (Sandbox Code Playgroud)
来自 - http://www.sencha.com/forum/showthread.php?37772-已解决 - 程序设计 - 点击 - - - 下一个 .Button
ExtJS 4.2.1
Ext.get('component-id-of-extjs-button').el.dom.click();
Ext.get('toggle-button2').el.dom.click();
Run Code Online (Sandbox Code Playgroud)
适合我.