ExtJS combo setting problem
Posted
by Hubidubi
on Stack Overflow
See other posts from Stack Overflow
or by Hubidubi
Published on 2010-03-24T08:49:26Z
Indexed on
2010/03/24
8:53 UTC
Read the original article
Hit count: 451
Hi
I run into an interesting problem while was using combos in input form. My form contains combos that get data from json stores. It works fine when adding new record, but when the form is opened for editing an existing record, sometimes the id appears as selected not its value (eg: there's 5 instead of "apple"). I think it tries to set the value before it finishes loading the combo.
Is there a way to solve this? I put the code down here that creates combos:
function dictComboMaker( store, fieldLabel, hiddenName, name, allowBlank, myToolTipp ) { comboo = { xtype : 'combo', id: 'id-'+name, allowBlank: allowBlank, fieldLabel : fieldLabel, forceSelection : true, displayField : 'value', valueField : 'id', editable: false, name: name, hiddenName : hiddenName, minChars : 2, mode: 'remote', triggerAction : 'all', store : store };
function dictJsonMaker(url) {
store = new Ext.data.JsonStore({
root : 'results', // 1
fields : [ 'id','value' ],
url : url,
autoLoad: true});
return store;
}
var comboKarStore = dictJsonMaker('/service/karok');
var comboKar= dictComboMaker(comboKarStore, 'Kar', 'karid', 'kar', false, '');
// then comboKar is added to the form
Hubidubi
© Stack Overflow or respective owner