2012-05-12 45 views
-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:"" 
}); 

有人可以幫助我,我應該使用什麼函數進行動態排序?謝謝

+1

你能鏈接到實際jqGrid的,表現出一定的代碼,寫你會從該插件和/或任何這將使其成爲真正的問題期望到底是什麼行爲?如果您沒有顯示任何代碼或鏈接,您是否希望我們讀取您的想法或破解進入您的計算機以獲取代碼並對其進行編輯,以便進行排序?您知道如果您不添加詳細信息,問題會再次關閉。 –

+0

[** DO。不。重新發布。 THE。相同。題。立即。後。 THE。持續。一。 WAS。 CLOSED。**](http://stackoverflow.com/questions/10561512/how-to-automatically-adjust-the-sorting) – rdlowrey

+0

對不起,但我需要幫助,你能幫我怎麼做嗎? –

回答