排序列表 Sencha Touch
我使用了“列表组件简介”中的示例代码。我能够在 Android 模拟器上成功运行它。现在我想按名字而不是姓氏对其进行排序。当我更改为排序器:“lastName”到firstName时,我可以看到索引栏不是按字母顺序排列的。如何按照正确的索引顺序按名字排序?
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" },
]
});
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" },
]
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将此行:更改
为:
change this line:
to: