2011-10-18 92 views
0

下面的代码是不排序,但分页工作。任何解决方案?排序问题jqgrid

 
$("#vendor_list").jqGrid({ 
     url: '/ra/vendor', 
     datatype: 'json', 
     ignoreCase: true, 
     colNames:['Vendor ID','Vendor Code', 'Vendor Name', 'Country', 'Approved', 'Location'], 
     colModel:[ 
        {name:'Vendor ID',index:'vendor_id', hidden:true}, 
        {name:'Vendor Code',index:'vendor_code', sorttype: 'text'}, 
        {name:'Vendor Name',index:'vendor_name', sorttype: 'text'}, 
        {name:'Country',index:'country', sorttype: 'text'}, 
        {name:'Preferred',index:'preferred', align:'center'}, 
        {name:'Location',index:'location_flag', align:'center'}, 
       ], 
     rowNum:5, 
     rowList:[5,10,20,30], 
     sortable: true, 
     loadonce: true, 
     mtype: "POST", 
     pager: $('#vendor_list_pager'), 
     sortname: 'id', 
     sortorder: 'asc', 
     multiselect: true, 
     viewrecords: true, 
     gridview: true, 
     //onPaging: function(which_button) { 
     // $('#vendor_list').setGridParam({datatype: 'json'}); 
     //}, 
     caption:"Vendor Selection List", 
}); 
+0

-1模糊*不*工作,没有HTML和无代码格式化。 – alex

回答

0

sortname: 'id'应该sortname: 'vendor_id'