PDA

View Full Version : Set data to a store



chinnib37
21 Apr 2013, 9:52 PM
Hi,
I am troubling to set t\data to store.
can you provide a solution to this.

my code is:

var cars = result[1];
var carStore = Ext.getCmp('carStore');
for ( var i = 0, c = cars.length; i < c; i++ ) {
cars[i] = [cars[i]];
}
carStore.setData(cars);


var Store = new Ext.data.ArrayStore({
fields: ['id','officeActivity'],
id:'carStore',
data : cars
});


var carActivityBox = new Ext.form.ComboBox({
store: Store ,
displayField: 'carActivity',
valueField: 'carActivity',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText: 'Select a state...',
selectOnFocus: true,


});

anyone give idea...

girish.arjunagi
21 Apr 2013, 10:44 PM
You can use the add method of store. Try with carStore.add(results[1])