1

我正在使用以下 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 工具栏下部的搜索选项后才尝试获取搜索框

您能否指出我的代码中缺少/错误的部分

4

1 回答 1

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});
于 2012-05-10T17:49:01.073 回答