0
我有下面的代碼塊時沒有排序:jqGrid的列點擊
$("#searchlist").jqGrid({
url:'./searchlibrary',
datatype: 'json',
mtype: 'POST',
postData: {type: function(){return $('select[name="searchtype"]').val();},
criteria: function(){return getSearchData();}
},
colNames:['Resource Name','Unit', 'Topic','Document Type','Content Type','Select'],
colModel :[
{name:'resourceName', index:'resourceName', width:380, align:'left'},
{name:'unit', index:'unitID', width:40, align:'center',sortable:true},
{name:'topic', index:'topicID', width:220, align:'center',sortable:true},
{name:'docType', index:'docTypeID', width:97, align:'center',sortable:true},
{name:'contentType', index:'contentTypeID', width:97, align:'center',sortable:true},
{name: 'select', index:'resourceID', width:55, align: "center", sortable: false, editable: true, edittype: "checkbox", editoptions: { value:"Yes:No", defaultValue:"No" }, formatter:"checkbox",formatoptions: {disabled : false}}
],
rowNum:20,
sortname: 'resourceName',
sortorder: 'asc',
viewrecords: true,
gridview: true,
width:878,
height:251,
loadComplete: function(data){
initCheckboxes();
$('input[type="checkbox"]').click(function(ev){
initCheckboxes();
});
}
});
數據加載就好了,但是當我點擊不同的列標題,他們不排序。裝載框在數據上簡要顯示,但列從未實際重新排序。排序工作的唯一列是第一列。任何幫助將不勝感激。
您爲其他列設置的'index'屬性與列名相比是不同的。當你對一個特定的列進行排序時,jQGrid傳遞你在索引處設置的值作爲排序參數(sidx)。 – VJAI 2012-07-20 14:22:48
就是這樣!謝謝。如果您將其作爲答案發布,我會將其標記爲接受的答案。 – LoneWolfPR 2012-07-20 15:15:59