View Full Version : strange store load always previous value

26 Feb 2010, 3:00 AM
i have a combobox with a json store:

this is a store:

var timbroSpecial = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'extjs.php?getspecialita=true&iddoc=1'
autoLoad: true,
reader: new Ext.data.JsonReader({
totalProperty: 'totalCount',
root: 'timbri',
id: 'id'
}, [
{name: 'id',mapping: 'id',type: 'string'},
{name: 'specialita',mapping: 'specialita',type: 'string'}

and this is the combobox code:

var searchTimbro = new Ext.form.ComboBox({
store: timbroSpecial,
fieldLabel: 'Specilità timbro',
hiddenId: 'idtimbro',
hiddenName: 'timbrospec',
emptyText: 'Seleziona il timbro...',
valueField: 'id',
id: 'timbro',
listWidth: 300,
allowBlank: false,
disabled: true,
name: 'timbro',
triggerAction: 'all',
mode: 'local',
forceSelection: true,
width: 300

i need dynamically preset the first element of the store after the reload of the store.

i user this code:


the first value is selected but the value selected is always the previous value..

i need a way to select always the forse value of the combobox without open the combox.

can you help me?

26 Feb 2010, 4:45 AM
U can use onload function and set the value..
timbroSpecial .on("load", function (e) {
//set the combo value here afer geting the value from the loded ds
searchTimbro.setValue( /*bla bla */);

26 Feb 2010, 5:16 AM
works great...

thank you