PDA

View Full Version : Taking text of buttons from simpleStore



SabaSarwat
30 Nov 2010, 10:31 PM
I have a card wizard layout in my application, two buttons for 'next' and 'previous' and a combo box. Combo has the names of different cards, so cards can be accessed through 'next' and 'previous' buttons as well as the selection in combo box. Now i wanted to show the next and previous card's title on 'next' and 'previous' buttons, like
'<< previous (card A)'
'Next (card C) >>'
For this purpose i have made a simple store :



var cardStore = new Ext.data.SimpleStore({
fields: ['id', 'cardName'],
data : [['0','card A'],
['1','card B'],
['2','card C']]
});


I want to pick the cardName from this store. When 'card B' is on screen, i want to pick its index '1' and then want to get the values for previous(index-1) and next(index+1). But the problem is with the index of selected card, i get the whole record, but unable to get only 'cardName'.



listeners : {
select : function(combo, record, index) {
var record = this.store.getAt(index); // returns the object
}
}


Kindly help.

Animal
30 Nov 2010, 10:38 PM
http://dev.extjs.com/deploy/dev/docs/?class=Ext.data.Record&method=get

SabaSarwat
30 Nov 2010, 11:10 PM
Thanks :)