ExtJs4如何递归地禁用面板上的所有字段和所有按钮 [英] ExtJs4 how to disable all fields and all buttons on a panel recursively

查看:130
本文介绍了ExtJs4如何递归地禁用面板上的所有字段和所有按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



调用 panel.disable()灰色,但按钮仍然可以点击。
同样的结果使 panel.cascade 具有禁用每个组件的功能。



正确的方法是什么?

解决方案

如果您正在使用ExtJs 4.x ,这是您正在寻找的 -

  myFormPanel.query ('.field,.button')。forEach(function(c){c.setDisabled(false);}); 

(根据您的表单的复杂性修改您的选择器,您只需使用.component即可禁用表单中的所有组件)



另请参见 - Ext.ComponentQuery



如果您使用 3.x ,则可以实现相同的在这两个步骤中效果 -

  myFormPanel.buttons.forEach(function(btn){btn.setDisabled(true);} ); //禁用所有按钮
myFormPanel.getForm()。items.each(function(itm){itm.setDisabled(true)}); //禁用所有字段


I'm trying to disable all clickable, editable components on my panel.

Calling panel.disable() grays it out, but buttons are still clickable. The same result gives panel.cascade with a function that disables each component.

What is the right way to do this?

解决方案

If you are using ExtJs 4.x, this is what you are looking for -

myFormPanel.query('.field, .button').forEach(function(c){c.setDisabled(false);});

(Modify your selector based on the complexity of your form. You can just use .component and it will disable all component in your form)

See also - Ext.ComponentQuery

If you are using 3.x, you can achieve the same effect in two steps like this -

myFormPanel.buttons.forEach(function(btn){btn.setDisabled(true);}); //disable all buttons
myFormPanel.getForm().items.each(function(itm){itm.setDisabled(true)}); //disable all fields

这篇关于ExtJs4如何递归地禁用面板上的所有字段和所有按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆