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

后端 未结 4 1515
无人共我
无人共我 2020-12-25 08:54

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 r

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-25 09:48

    This is a better solution to disabling all form fields inside a form panel.

    var formPanelName = Ext.ComponentQuery.query('#formPanelId field');
    for(var i= 0; i < formPanelName.length; i++) {
       formPanelName[i].setDisabled(true);
    }
    

    Just get a reference to the form panel fields. Iterate over each field and use the setDisabled function to set its readOnly attribute to true.

    You can also take it a set further and grab the entire form Panel. This solution above only grabs individual sections of the form panel by its ID. extjs 4

提交回复
热议问题