Javascript 在EXTJS的GridPanel中按组排序顺序对分组数据进行排序
如何按排序器对EXT JS网格面板分组数据进行排序Javascript 在EXTJS的GridPanel中按组排序顺序对分组数据进行排序,javascript,extjs,Javascript,Extjs,如何按排序器对EXT JS网格面板分组数据进行排序 {Grouped data} {Sort Order} Audi [3] col11 col22 xol33 col21 col23 cole3 Benz [1] col23 col32 cos32 col32 dos34 sdfd2 Citron
{Grouped data} {Sort Order}
Audi [3]
col11 col22 xol33
col21 col23 cole3
Benz [1]
col23 col32 cos32
col32 dos34 sdfd2
Citron [4]
jkj23 dfd23 fds23
jkjkk jjkkk jkkkk
Nissan [2]
col23 col32 cos32
col32 dos34 sdfd2
对于上面的数据,我想按其排序顺序进行排序(因为我得到了groupdatastore中每个group元素的排序顺序),如下所示
在GroupingStore集合属性中:
sortInfo: {field: 'Sort_order', direction: 'ASC'},
尝试在商店中设置这些选项:
remoteGroup:true,
remoteSort: true
在您的sql或您用来获取数据的东西中,首先按分组字段排序
gridDataStoreObj = new Ext.data.GroupingStore(
{
remoteGroup:true,
remoteSort: true,
proxy: new Ext.data.HttpProxy({url: 'index.php' }),
method:'POST',
groupField:'brandName',
...
sortInfo:{field: 'id', direction: "ASC"},
});
在服务器上:
select * from table order by brandName, id
这应该对组本身进行排序。对于extjs 4和本地排序,而不是使用:
groupField:'mygroupfield'
在商店上
使用:分组:[{
属性:“任务列表\u id”,
sorterFn:函数(o1,o2){}
}]
在应用商店中,使用排序顺序列作为组字段
在网格中:
features: [
{
ftype: 'grouping',
groupHeaderTpl: [
'{[values.rows[0].groupId]}'
]
}
]
其中groupId是要显示的列的“id”SortInfo将仅对组内的数据进行排序,即在日产集团中,row1和row2将根据SortInfo的条件进行排序,但在我的情况下,由于日产集团内的所有行具有相同的排序顺序,因此不会产生任何影响。我想对组本身进行排序(即Benz、Nissan、Audim、Citron)不是组内的数据。@Jemsworld:您能在ExtJS中找到解决方案吗?我不想在后端实现远程排序。这很好,但即使只有remoteGroup而不是remoteSort,列的任何排序都会转到服务器进行排序。
features: [
{
ftype: 'grouping',
groupHeaderTpl: [
'{[values.rows[0].groupId]}'
]
}
]