Reputation: 710
I have used the example code from "Intro to List Components". I was able to successfully run it on a android simulator. Now I want to sort it by firstName rather the lastName. When I changed to sorters: "lastName" to firstName, I can see that the Index bar is not in alphabetical order. How can I sort by firstName with proper index order?
Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
ListDemo.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('lastName')[0];
},
data: [
{ firstName: "Domino", lastName: "Derval" },
{ firstName: "Elektra", lastName: "King" },
{ firstName: "Fiona", lastName: "Volpe" },
{ firstName: "Holly", lastName: "Goodhead" },
]
});
Upvotes: 0
Views: 2278
Reputation: 2974
change this line:
getGroupString : function(record) {
return record.get('lastName')[0];
},
to:
getGroupString : function(record) {
return record.get('firstName')[0];
},
Upvotes: 1