現在、私はJava jqgridで作業しています。列ヘッダーをクリックした後にソートされたグリッドを表示したい.私はすでにonsortcol.を使用していますが、動作していません.彼女は私のcode.onsort col関数がアクティブですが、ソートを実行しません.thanksあらかじめ
コード:
jq(function() {
var base = "<%=request.getContextPath()%>";
var records = -1;
jq("#grid").jqGrid({
url:base+'/admin/adminusermanagecrud.htm',
datatype: 'json',
mtype: 'GET',
colNames:['', 'Name','Employee ID','User Name','Mobile','City','State','Is Active','Created Date','Role','Bank Name'],
colModel:[
{name:'id',index:'id', width:55,editable:false,hidden:true},
{name:'adminName',index:'adminName', width:175,editable:true,sortable:true, editrules:{edithidden:true,required:false}, editoptions:{size:25,readonly:false,disabled:false},search:false},
{name:'adminEmployeeId',index:'adminEmployeeId', width:175,editable:true, editrules:{edithidden:true,required:false}, editoptions:{size:25,readonly:true,disabled:false},search:true},
{name:'adminuserName',index:'adminuserName', width:175,editable:true, editrules:{edithidden:false,required:false}, editoptions:{size:25,readonly:false,disabled:false},search:true},
{name:'mobile',index:'mobile', width:175,editable:true, editrules:{edithidden:false,required:false}, editoptions:{size:25,disabled:false},search:true},
{name:'city',index:'city', width:175,editable:true, editrules:{edithidden:true,required:false}, editoptions:{size:25,disabled:true},search:true},
{name:'state',index:'state', width:175,editable:true, editrules:{edithidden:true,required:false}, editoptions:{size:25,disabled:true},search:true},
{width:165,formatter:linkFormat,editable:true,edittype:'select',editrules:{edithidden:true,required:false}, editoptions:{value:"0:Activate;1:De-Activate",size:25,disabled:false,multiple:false},search:false},
{name:'createDate',index:'createDate',width:185,editable:true, editrules:{edithidden:true,required:false}, editoptions:{size:25,disabled:true},search:false},
{name:'role',index:'role',width:175,editable:true,editrules:{edithidden:true,required:false},editoptions:{size:25,disabled:true},search:false},
{name:'bankName',index:'bankName',width:175,editable:true,editrules:{edithidden:true,required:false},editoptions:{size:25,disabled:true},search:false}
],
postData:{
},
loadError:function(xhr,status,error)
{
var base = "<%=request.getContextPath()%>";
alert(status);
if(xhr.status == '403' || xhr.status == '401' || status == 'parsererror')
{
window.location.href = base+"/login.htm";
}
},
rowNum:5,
//rowList:[5,10,15,20],
height: 150,
//width:750,
autowidth: true,
rownumbers: true,
pager: '#pager',
sortname: 'adminName',
scrollrows:true,
viewrecords: true,
sortorder: "asc",
caption:"Admin Users Summary",
onSortCol: function (index, columnIndex, sortOrder) {
alert(index);
return 'stop';
},
cellEdit: false,
emptyrecords: "Search returned no results",
loadonce: false,
loadComplete: function()
{
},
jsonReader : {
root: function(obj)
{
if(obj.status == false)
{
window.location.href = base+"/login.htm";
}
else
{
records = obj.records;
return obj.rows;
}
},
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id"
},
editurl:base+"/admin/edit.htm"
});
jq("#grid").navGrid('#pager',
{edit:false,add:false,del:false,search:true,excel:true},
{ },
{ },
{ },
{
sopt:['eq','cn', 'bw', 'ew'],
closeOnEscape: true,
multipleSearch: false,
closeAfterSearch: true
}
);
jq("#btnFilter").click(function()
{
jq("#grid").jqGrid('searchGrid',
{
multipleSearch: false,
sopt:['eq']
}
);
});
});