PDA

View Full Version : Combo box show list based on response



undefined
19 Jun 2012, 2:36 AM
Hi,

I have a Ext JS combo box with proper remote configs.The combo box is working normally. I want to modify the list options to show only if the record has one particular attribute and not show if the attribute is missing, any ideas.


var simpleCombo = Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Select a single state', renderTo: 'simpleCombo', displayField: 'name', width: 500, labelWidth: 130, store: store, queryMode: 'remote', typeAhead: true });

The response obtained is like


{"avail":"Y", "root" : [{"abbr":"AL","name":"Alabama","slogan":"Y"}]}I want the list to be shown only if the avail = Y. If the value of avail is anything but Y I dont want the list to be shown, anyideas how do I do this.

Guess might have todo something in



simpleCombo.getStore.on('load', function (store, records, successful, options) {
// some code to solution
});

redraid
19 Jun 2012, 3:22 AM
Use store filters - store.filter("avail", "Y");