gpt4 book ai didi

javascript - ExtJs MVC 将按钮处理程序放入 Controller 中

转载 作者:行者123 更新时间:2023-11-30 08:08:30 26 4
gpt4 key购买 nike

在 ExtJs MVC 中是否有任何方法可以将按钮处理程序放入 Controller 中,如下所示:

this.control({
'storage_settings button[action=submit_settings]': {
handler: this.submit_settings_handler
})

或者我是否必须使用其他东西,例如 click 事件?

最佳答案

好吧,您的代码确实定义了要收听的按钮 (storage_settings button[action=submit_settings]) 但没有定义要收听的事件(除非有一个名为 handler 的事件>,没有)。

handler 是一个配置选项,如果您不使用 MVC(因此处理程序将在 View 代码中),您可以提供。由于您使用的是 MVC,因此您应该监听 click 事件。所以:

this.control({
'storage_settings button[action=submit_settings]': {
click: this.submit_settings_handler
});

这也应该有效:

this.control({
'storage_settings button[action=submit_settings]': {
click: function( aButton, aEvent, aOptions )
{
}
});

关于javascript - ExtJs MVC 将按钮处理程序放入 Controller 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14059834/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com