我有一个jqgrid,我有一个处理我的排序的SortNo字段,当我在sortNo中添加相同的数字并且按顺序自动调整数字时,我怎么能动态调整它的排序。请在上面的链接中查看我的示例。有人可以帮帮我吗?
$(document).ready(function(){
var xaxis=645
var yaxis = $(document).height();
yaxis = yaxis-100;
getGrids();
$("#maingrid").jqGrid({
url:'models/gridheaders.php?todo=select&id=new',
datatype: 'xml',
mtype: 'POST',
colNames:['ID','Description_EN','Description_JP',
'SortNo','ColWidth','GridID','Module'],
colModel :[
{name:'id', index:'id', width:120, align:'center',sortable:false,editable:false,editoptions:{size:"30",maxlength:"30"}},
{name:'eng', index:'eng', width:120, align:'center',sortable:false,editable:true,edittype:"text",editoptions:{size:"30",maxlength:"30"}},
{name:'jap', index:'jap', width:120, align:'center',sortable:false,editable:true,edittype:"text",editoptions:{size:"30",maxlength:"30"}},
//This field is I want to dynamically sort.
{name:'sort', index:'sort', width:120, align:'center',sortable:false,editable:true,edittype:"text",editoptions:{size:"30",maxlength:"30"}},
{name:'col', index:'col', width:120, align:'center',sortable:false,editable:true,
edittype:"text",editoptions:{size:"30",maxlength:"30"}},
{name:'grid', index:'grid', width:120, align:'center',sortable:false,editable:true,hidden:true,edittype:"text",
editoptions:{size:"30",maxlength:"30"},editrules: { edithidden: true}},
{name:'used', index:'used', width:120, align:'center',sortable:false,editable:true,hidden:true,edittype:"text",editoptions:{size:"30",maxlength:"30"},editrules: { edithidden: true}},
},
],
viewrecords: true,
rowNum: -1,
height: yaxis,
width: xaxis,
shrinkToFit: false,
multiselect: true,
editurl:""
});
有人可以帮助我,我应该用什么功能进行动态排序?谢谢
答案 0 :(得分:1)
您可以查看DataTables。它可以很容易地与jQuery和jQuery UI集成,它包括多列排序。
http://datatables.net/release-datatables/examples/basic_init/multi_col_sort.html