PDA

View Full Version : How can I get ComboBox store ??



robert6000
29 Jun 2008, 9:02 AM
Hi

I want to get value from ComboBox store dependence of selected value in ComboBox. I do this in this way and everything works well.



Ext.onReady(function(){

var data = [
['AL', 'Alabama', 'The Heart of Dixie'],
['AK', 'Alaska', 'The Land of the Midnight Sun'],
['AZ', 'Arizona', 'The Grand Canyon State'],
];

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

var combo = new Ext.form.ComboBox({
store: store,
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
applyTo: 'local-states'
});

combo.on('select', selectFn);

function selectFn(){
var idx = store.find('state', combo.getValue());
var record = store.getAt(idx);
alert(record.get('abbr'));
};
});


Now in my application I have two stores and one of them is set in my ComboBox dependence of parameter, so I don't know the store name right now. In gridPanel there is something like this:



getStore() : DataSource
Returns the grid's data store.


Is there any way to get ComboBox store ??

Thanks
Robert

Animal
29 Jun 2008, 10:18 AM
combo.store