Lets say I have the data set:
假设我有数据集:
[{ id: 1, name: "C" }, { id: 2, name: "A" }, { id: 3, name: "D" }]
When I build up the columns for the grid similar to this:
当我为网格构建类似于此的列:
this.columns =
{
id: {
hidden: true
},
name: {
text: 'Name',
editor: {
xtype: "textfield"
}
}
};
When I sort the 'Name' column, I want it to be sorted by the 'id' and not alphabetically.
当我对“名称”列进行排序时,我希望它按“id”排序,而不是按字母顺序排序。
So instead of sorting like this: A, C, D I want it to be: C, A, D
所以不要像这样排序:A,C,D我希望它是:C,A,D
I've tried using dataIndex: 'id' on the name column and then mapping the id to the correct name for displaying purposes, but that interferes with my editing functionality.
我尝试在名称列上使用dataIndex:'id',然后将id映射到正确的名称以用于显示目的,但这会干扰我的编辑功能。
Is there an easy way in Ext (I'm using Ext 4.2) to sort the name column by ids?
在Ext(我使用Ext 4.2)中有一个简单的方法可以用ID对名称列进行排序吗?