是否有方法从 pagintoolbar 获取所有启用的按钮?

Are there method to get all enabled buttons from pagingtoolbar?

我的问候!

我正在尝试通过热键专注于第一个 pagintoolbar 的按钮。例如,当按下组合键 CTRL + --> 时,焦点将位于分页工具栏的第一个启用按钮上。

此时我可以得到第一个禁用按钮:

Ext.ComponentQuery.query('pagingtoolbar button{isDisabled()}')[0] 

但我需要这样的代码:

Ext.ComponentQuery.query('pagingtoolbar button{isEnabled()}')[0]

我还以为Ext.button.Button里面有这样的方法,但是没找到。 显然,我可以通过其他方式解决我的问题,例如,我可以通过以下代码获取分页工具栏中所有启用的按钮:

var buttons = Ext.ComponentQuery.query('pagingtoolbar button');
var en_buttons = [];
for(var i=0;i<buttons.length;i++){
  if( !buttons[i].isDisabled() )en_buttons.push(buttons[i]);
}
en_buttons[0].focus(false,100); 

但我认为没有必要写这样的代码,必须一行代码解决。

此致, A

您可以使用 disabled 属性.

禁用的按钮:

Ext.ComponentQuery.query('pagingtoolbar button[disabled=true]')

启用的按钮:

Ext.ComponentQuery.query('pagingtoolbar button[disabled=false]')