【发布时间】:2012-03-06 06:26:55
【问题描述】:
我正在尝试使用 PHP MVC 结构的 JqGrid。 我不想使用 Jq Grid 的搜索功能,而是想要通用关键字搜索。 我在 json 数组中有数据。请让我知道如何使用我的 json 数据集执行搜索。
这个搜索应该在多个列上执行。
这是我的搜索表单
<form name="frmsearch" id="frmsearch">
<input type="text" id="txtsearch" name="txtsearch"/>
<a href="javascript:void(0);" onClick="doSearch();">Search</a>
</form>
这是我的网格
$(document).ready(function () {
jQuery("#agentlist").jqGrid({
url: "manageagents/getagents/",
datatype: "json",
mtype:"POST",
jsonReader: {
root: "rows",
page: "currpage",
total: "totalpages",
records: "totalrecords",
id: "0",
cell:"",
repeatitems: false
},
colNames: ['Id','Agent Name', 'Email Address', 'Phone No.1', 'Phone No.2','City', 'State', 'Country'],
colModel: [
... ... ...
],
rowNum:<?php echo $this->config->item('per_page');?>,
rowList:<?php echo $this->config->item('nav_page');?>,
pager: '#plist',
autowidth: true,
height: "100%",
loadonce: true,
viewrecords: true,
altRows:true,
caption: "",
}).navGrid('#plist', { edit: false, add: false, del: false, search: true, refresh: false }); ;
});
【问题讨论】:
标签: php javascript jquery json jqgrid