我正在使用以下jqgrid代码:
jQuery("#list2").jqGrid({
url:'<?php echo $url;?>',
datatype: "json",
colNames:[
<?php
$sep = "";
foreach($columns as $col){
echo $sep . "'" . $col['header'] . "'";
$sep = ",";
}
?>
],
colModel:[
<?php
$sep = "";
foreach($columns as $col){
echo $sep . "{name:'" . $col['name'] . "',index:'" . $col['name'] . "', width:" . $col['width'] . ", sortable:true, search:true}";
$sep = ",";
}
?>
],
rowNum:100,
rowList:[100,200,300,400],
pager: '#pager2',
loadonce: true,
sortname: 'geneID',
viewrecords: true,
width:700,
shrinkToFit:false,
height:700,
sortorder: "desc",
caption:"Breeder Tool Box"
});
jQuery("#list2").navGrid('#pager2',{add: false, edit: false, del: false,search : true , refresh : true},{},{},{});
jQuery("#list2").searchGrid({multipleSearch:true}); // For Adding the Multiple Search Option on the jqgrid
默认情况下,当网格加载时,搜索框会打开。
我想在点击jqgrid工具栏下方的搜索选项后才能获取搜索框
您能否指出我的代码中缺少/错误的部分
答案 0 :(得分:2)
来自wiki对searchGrid方法的引用
Typically when this method is called it launches the modal dialog and makes it so the grid inaccessible until the dialog is closed.
This method is not the default search method in the navigator. To enable this you should either set the default search options using the extend method or set it in the navigator in the place of the search options.
因此,您调用搜索模式而不是将网格指定为具有搜索模式。您应该以这种方式分配多个搜索:
jQuery("#list2").navGrid('#pager2',
{add: false, edit: false, del: false,search : true ,refresh : true},
{},
{},
{},
{multipleSearch:true});
那么这一行应该删除:
jQuery("#list2").searchGrid({multipleSearch:true});