本文介绍了通过group_sort_order对EXTJS的GridPanel中的分组数据进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何排序EXT JS Grid Panel按其sortOrder分组数据

How to sort the EXT JS Grid Panel grouped data by its sortOrder

{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中的每个组元素的排序顺序)如下

Fot the above data I want to by sort its sort order (as i got sort order for each group element in my groupdatastore) as below

 Benz                            [1]
    col23 col32 cos32
    col32 dos34 sdfd2
 Nissan                          [2]
    col23 col32 cos32
    col32 dos34 sdfd2
 Audi                            [3]
    col11 col22 xol33
    col21 col23 cole3
 Citron                          [4]
    jkj23 dfd23 fds23
    jkjkk jjkkk jkkkk


推荐答案

尝试在商店中设置这些:

Try setting these on the store:

remoteGroup:true,
remoteSort: true

在你的sql或你用来通过分组字段获取数据排序。

And in you sql or what you use to get data out sort by grouping field first.

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

这应该对组本身进行排序。

This should sort groups themselves.

这篇关于通过group_sort_order对EXTJS的GridPanel中的分组数据进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 12:25