franzisk
19 May 2007, 4:36 AM
I need to do something (load states to the choosen country) when the value in the ComboBox field change, it can be with setValue(...) or when user selects in the dropdown list (this last one I have it working).
So I have this:
var dsCountries = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'action_getLocation.php?id=1'
}),
reader: new Ext.data.JsonReader({
root: 'countries',
totalProperty: 'totalCount',
id: 'id'
}, [
{name: 'abr'},
{name: 'id', type:'int' },
{name: 'name'}
])
});
var comboProfileCountry = new Ext.form.ComboBox({
store: dsCountries,
displayField:'name',
valueField:'id',
loadingText: 'Loading...',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a country...',
selectOnFocus:true,
lazyRender:true,
forceSelection:true
});
comboProfileCountry.applyTo('PROFILE-COUNTRY');
dsCountries.on('load', function(){
comboProfileCountry.setValue(<?=$rec['countryID'];?>);
// Here I need to get the selected 'abr' of the selected item
},
this,
{single: true}
);
dsCountries.load();
So I have this:
var dsCountries = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'action_getLocation.php?id=1'
}),
reader: new Ext.data.JsonReader({
root: 'countries',
totalProperty: 'totalCount',
id: 'id'
}, [
{name: 'abr'},
{name: 'id', type:'int' },
{name: 'name'}
])
});
var comboProfileCountry = new Ext.form.ComboBox({
store: dsCountries,
displayField:'name',
valueField:'id',
loadingText: 'Loading...',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a country...',
selectOnFocus:true,
lazyRender:true,
forceSelection:true
});
comboProfileCountry.applyTo('PROFILE-COUNTRY');
dsCountries.on('load', function(){
comboProfileCountry.setValue(<?=$rec['countryID'];?>);
// Here I need to get the selected 'abr' of the selected item
},
this,
{single: true}
);
dsCountries.load();