PDA

View Full Version : Lookup Stores



fruitwerks
14 Aug 2009, 5:45 PM
I have done this by way of a combobox editor for an editor grid, but now I need a simple gridpanel and I can not figure out how to do this for a remote store.



var eventsDB = new Ext.data.SimpleStore({
fields: ['event_id', 'ev_name'],
data: [['1', 'apple'], ['2', 'orange'], ['3', 'strawberry']]
});

function evlookup(val) {
return eventsDB.queryBy(function(rec) {
return rec.data.event_id == val;
}).itemAt(0).data.ev_name;
}

Thanks!

15 Aug 2009, 5:30 AM
?? are you trying to build a grid *from* a store?

fruitwerks
15 Aug 2009, 11:25 AM
I have a grid, but instead of numbers, I need to match values from another store and display something I can understand.

fruitwerks
16 Aug 2009, 5:31 PM
What I am trying to do is create a renderer for a grid, simply it will take the value for that cell and ask another store for the associative field for that value, thus giving me something I can read.

Sorry, I was told that my post makes no sense!

17 Aug 2009, 8:29 AM
if the 2nd store's request is depending on the 1st store's result, you have to put the 2ndStore.load() into the 1stStore's on "load" event.

Otherwise the 2nd store can do nothing due to the asyn. call.

simply:



1stStore = new Ext.data.xxxStore ({
...
listeners: {
load: function (store, records) {
2ndStore.load({params{something: records[i].data.xxxx}});
}
}
})