1
我一直在使用的jqGrid现在几个月了,和我进行了数据网格与filterToolbar选项了一把:的jqGrid filterToolbar传递_search:假搜索
$('#grid_id').jqGrid('filterToolbar');
它在过去的工作完美(将一个POST变量数组传递给jqGrid定义中的url选项中定义的php页面,其中有一个变量“_search:true”)。我最近使用的网格,在按下filterToolar上的输入后,它只是重新加载网格...将“_search:false”传递给php脚本。有谁知道为什么会发生这种情况。这里是脚本;
$('#processed_list').jqGrid({
url:'/phpAJA?&sql=' + sql,
editurl: '/phpAJAX?sql=' + sql,
height: 225,
width: 600,
datatype: 'xml',
mtype: 'POST',
colModel:[
{name:"Invoice Num",index:"InvoiceNum",width:"8"},
{name:"Job Num", index:"JobNum",width:"8"},
{name:"Customer",index:"Customer",width:"16"},
{name:"Emailed To",index:"to_email",width:"16"},
{name:"Date Processed",index:"timestamp",width:"16"}
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'invid',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Processed Invoices',
editable: false
});
$("#processed_list")
.jqGrid('navGrid', '#pager', {edit: false,add: false, del: false, search: false, refresh:true},{},{},{},{},{})
.jqGrid('navButtonAdd',"#pager",{
caption:"reprint invoice", buttonicon:"ui-icon-print", onClickButton:function(){ ...some function... }, position: "last", title:"", cursor: "pointer"
})
.jqGrid('filterToolbar');
就像我说的,只是当我尝试toolbarFilter搜索这一切的作品,它只是重新加载网格(通过“_search:假”的PHP脚本)。
任何帮助将不胜感激。
谢谢。
所以我想出了一个小试验和错误的问题。 filterToolbar引用了colModel中的列名称,而不是索引,它应该引用它。因此,在jqGrid定义中的colModel选项中,我必须将名称更改为数据库中的实名,然后添加其他colName选项以重置网页中的列标题。 –
请发表您的评论作为回答,所以这个问题不会在SO系统中得不到解答。 –
由于新用户的发布指南,我评论了我的答案,当时它不会让我发布答案。我现在会发布答案。 –