-1

https://lh6.googleusercontent.com/-jVwVJRmL-4M/T638dHzocNI/AAAAAAAAACU/8OLqf8cDDQc/w785-h247-k/sample.JPG

我有一个 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:""
}); 

有人可以帮助我,我应该使用什么功能来进行动态排序?谢谢

4

1 回答 1

1

您可以检查数据表。它可以很容易地与 jQuery 和 jQuery UI 集成,并且它包括多列排序。

http://datatables.net/release-datatables/examples/basic_init/multi_col_sort.html

于 2012-05-12T07:08:04.500 回答