Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJs4 how to disable all fields and all buttons on a panel recursively

Tags:

extjs

extjs4

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?

like image 326
Andrey Selitsky Avatar asked Feb 20 '12 21:02

Andrey Selitsky


1 Answers

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
like image 83
Amol Katdare Avatar answered Oct 15 '22 13:10

Amol Katdare