Javascript 在JqGrid中,Are组可以按字母以外的顺序排序
我从服务器得到响应,该服务器按特定顺序分组提供数据。但是,当我在jqGrid中加载数据时,它会自动按字母顺序对组进行排序,并且我需要服务器向我提供数据的顺序 例如,我得到的数据分为三组,即大学、学院、学校 现在,这可以分为递增顺序,即学院、学校、大学 或 可以按降序排列,即大学、学校、学院 我应该怎么做才能使订单在从服务器取回时保持相同的顺序 我想做一些补充,服务器的响应存储在一个对象中,然后我将该数据加载到网格中,所以我猜它的本地数据。。。 对不起,我是jqGrid的新手 这是我的jqgrid代码Javascript 在JqGrid中,Are组可以按字母以外的顺序排序,javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,我从服务器得到响应,该服务器按特定顺序分组提供数据。但是,当我在jqGrid中加载数据时,它会自动按字母顺序对组进行排序,并且我需要服务器向我提供数据的顺序 例如,我得到的数据分为三组,即大学、学院、学校 现在,这可以分为递增顺序,即学院、学校、大学 或 可以按降序排列,即大学、学校、学院 我应该怎么做才能使订单在从服务器取回时保持相同的顺序 我想做一些补充,服务器的响应存储在一个对象中,然后我将该数据加载到网格中,所以我猜它的本地数据。。。 对不起,我是jqGrid的新手 这是我的jqgrid
GRID = $("#"+GRID_ID).jqGrid({
url: sample,
datatype: 'json',
jsonReader : {
root:"rows",
page: "page",
total: "total",
records: "records",
//repeatitems: false,
},
colNames: ['File', 'UID', 'Order', 'Type', 'Project','Method', 'Phase' , 'Group'],
colModel: [{
name: 'file',
index: 'file',
width: 140
}, {
name: 'uid',
index: 'uid',
width: 80
}, {
name: 'order',
index: 'order',
width: 60,
sortable:true
}, {
name: 'type',
index: 'type',
width: 75,
editable:true,
edittype:"select",
editrules: { required: true }
}, {
name: 'project',
index: 'project',
width: 100,
editable:true,
edittype:"select",
editrules: { required: true }
}, {
name: 'method',
index: 'method',
width: 60,
editable:true,
edittype: "select",
editrules: { required: true },
//editoptions: { size: 71}
},{
name: 'phase',
index: 'phase',
width: 75,
editable:true,
edittype:"select",
editrules: { required: true }
},{
name: 'group',
index: 'group',
width: 75,
sortable: false,
hidden:false
}],
loadComplete: function() {
$("#"+GRID_ID).setColProp('type', { editoptions: { value: types} });
$("#"+GRID_ID).setColProp('project', { editoptions: { value: project} });
},
//rowNum: 10,
autowidth: true,
rowList: [10, 50, 100],
pager: $("#"+PAGER_ID),
loadonce: true,
sortname: 'order',
viewrecords: true,
sortOrder: "asc",
multiSort: false,
pgbuttons: true,
pginput: true,
cellEdit: true,
cellsubmit : 'clientArray',
editurl: 'clientArray',
height: "100%",
toolbar: [true, "bottom"],
grouping:true,
groupingView : {
groupField : ['group'],
groupDataSorted : true,
groupSorted:false,
groupColumnShow:[true],
sortable:false
},
caption: 'JqGrid Examples'
}).navGrid("#"+PAGER_ID, {
edit: false,
add: false,
del: false
});
我也有同样的问题。我已经解决了如下问题 1) 在行中添加了索引字段 2) 为服务器端的每一行提供订单(如1,2,3…) 3) JQGrid中的属性和设置
loadonce: false,
altRows: true,
sortname: 'index', /* this filed */
sortorder: "asc", /* this filed */
grouping: true,
groupingView: {
groupField: ['group'],
groupColumnShow: [false],
groupCollapse: true,
groupSorted: false, /* this filed */
groupDataSorted: true /* this filed */
},
使用所有4/*此字段*/值,我们可以实现这一点
假设在您的案例中,组(组中的元素)如大学(a、b)、学院(x、y、z)、学校(p、q、r、s、t)
然后在服务器端。
(指数,elment)(1,a)、(2,b)、(3,x)、(4,y)、(10,t)。
试试这个,如果没有工作就告诉我。
Thanx.我也有同样的问题。我已经解决了如下问题 1) 在行中添加了索引字段 2) 为服务器端的每一行提供订单(如1,2,3…) 3) JQGrid中的属性和设置
loadonce: false,
altRows: true,
sortname: 'index', /* this filed */
sortorder: "asc", /* this filed */
grouping: true,
groupingView: {
groupField: ['group'],
groupColumnShow: [false],
groupCollapse: true,
groupSorted: false, /* this filed */
groupDataSorted: true /* this filed */
},
使用所有4/*此字段*/值,我们可以实现这一点
假设在您的案例中,组(组中的元素)如大学(a、b)、学院(x、y、z)、学校(p、q、r、s、t)
然后在服务器端。
(指数,elment)(1,a)、(2,b)、(3,x)、(4,y)、(10,t)。
试试这个,如果没有工作就告诉我。
Thanx.它应该按照您从服务器接收的顺序显示。你能把你的jqGrid代码发布在这里让我看一下吗?是的,你需要把一些代码发布到你的数据的服务器上。它很可能是在对您的数据进行排序,并根据字母顺序以asc或desc的形式返回数据。它应该按照您从服务器接收数据的顺序显示。你能把你的jqGrid代码发布在这里让我看一下吗?是的,你需要把一些代码发布到你的数据的服务器上。它很可能是在对数据进行排序,并根据字母顺序以asc或desc的形式返回数据。