Combined Download and Disable ExtJS

I summarize a problem like this.

I use the form to edit user information that is loaded from the database (I get these values โ€‹โ€‹through JSONStore)

I want to enable / disable combos depending on the loaded value of another combo.

Example: disable combo2 if the loaded value in combo1 = 0

  • if I load combo1 = 1, combo2 = 12: Everything is fine
  • if i load combo1 = 0, combo2 = 15: disable combo2

Any ideas? Thanks

+4
source share
2 answers

Such a listener must complete the following task:

formEditUser.getForm().on('actioncomplete',function(form,action) { if(combo1.getValue() == 0) { combo2.disable(); } else if (combo1.getValue() == 1) { combo2.enable(); } }) 
+2
source

working code segment:

 enter code here {xtype: 'fieldset', items: [{xtype: 'combo', hiddenName: 'category[line]', fieldLabel: 'Category', store: categories, emptyText: 'Select', triggerAction: 'all', mode: 'local', displayField: 'category_name', valueField: 'id', anchor: '50%', listeners:{ select:{fn:function(thisCombo, value) { var combo = Ext.getCmp('combo-subcats'); combo.enable(); //combo.clearValue(); /* category is part of the json data inside the subcat. So the first select choose the category - then filter out only that bit and populate the subcat combo. Make sense? */ combo.store.filter('category', values.data['category']); }} } }, {xtype: 'combo', hiddenName: 'subcats[line]', disabled: true, id: 'combo-subcats', fieldLabel: 'Sub Cat', store: getSubcatsStore(), emptyText: 'Select', triggerAction: 'all', mode: 'local', displayField: 'name', valueField: 'id', anchor: '50%', lastQuery: '' //<-- this is what makes it work. }, 
0
source

All Articles