我正在使用版本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 –