1 post tagged combobox

EXT remote-loading forms with Combo boxes

Something that's harder than it should be is populating an EXT edit form with form data, where one of the form fields is a select box. If there is a specific set of values that this select can take, then you can hard code that using a SimpleStore, like this:


var exampledata = [['AL', 'Alabama'],
['AK', 'Alaska'],
['AZ', 'Arizona'],
['AR', 'Arkansas'],
['CA', 'California']];

var store = new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : exampleData
});

var combo = new Ext.form.ComboBox({
store: store,
displayField: 'state',
valueField: 'abbr',
... etc ...
});

form = new Ext.form({
items: [combo],
... etc ...
});

form.load(url_to_load_from);

So that will populate the select box with the static values you've defined (the 5 states above), then when the form loads it will select the appropriate option automatically.

Continue reading