我正在使用版本4.13.1的freejqGrid。我只是添加了過濾器工具欄的代碼,這是工作,除了搜索後搜索參數消失。搜索工作和一切,但我想留在工具欄中的文本,直到清除使用(x)。免費jqGrid搜索參數在filterToolbar中消失
$('#jqGrid_destroyed').jqGrid({
url:'/url.php',
height: 'auto',
shrinkToFit: true,
width: Math.floor($(window).width()*1),
datatype: 'json',
mtype: 'POST',
colNames:[
'Flat ID',
'Customer',
'Flat #',
'MiscCode',
'Item Number',
'Item Description',
'plus',
'RevDate',
'Created Date',
'Plate/Flat in QA',
'Computer Files to Waiting Destruct',
'Plates/Flat Destroyed',
'Date Confimation Sent to Customer'
],
colModel:[
{name:'flat_id',hidden:true},
{width:14,name:'Customer'},
{width:10,name:'flat_plate_num'},
{width:13,name:'MiscCode'},
{width:20,name:'item_number'},
{width:45,name:'item_description'},
{width:12,name:'plus'},
{width:16,name:'revdate'},
{width:22,name:'created_date', align: "right", hidden:true},
{width:17,name:'flat_in_qa'},
{width:20,name:'computer_files_to_waiting_destruct'},
{width:25,name:'flat_destroyed'},
{width:20,name:'date_confimation_sent_to_customer', formatter : 'date', formatoptions : {srcformat: "Y-m-d", newformat:"m/d/Y"}}
],
sortname: 'date_confimation_sent_to_customer',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Waiting Destruct',
rowNum: 10000,
pager:true,
searching: { defaultSearch: "cn" }
}).jqGrid("filterToolbar");
除非您手動調用網格刷新,否則不應清除搜索參數。你可以使用靜態數據在小提琴中重現問題嗎? –
是的,頁面上沒有太多的其他代碼,似乎沒有再次重新加載。當然,搜索後需要重新加載才能加載新數據。我想知道是否需要將搜索參數從服務器傳遞迴帶有數據的客戶端? –
我爲你做了小提琴,你的代碼工作正常:http://jsfiddle.net/ejnrtocw/121/。注:我使用jqGrid 4.6.0,你可以嘗試上傳4.13.1 –