【问题标题】:Reset JqGrid search string重置 JqGrid 搜索字符串
【发布时间】:2012-05-08 10:49:46
【问题描述】:

执行搜索后,我需要重置搜索字符串。

我尝试更改搜索列,但搜索字符串未重置。

如何从搜索弹出窗口重置搜索字符串?

【问题讨论】:

    标签: jquery-ui jquery jquery-plugins jqgrid


    【解决方案1】:

    我不确定我是否正确理解您想要的内容。使用recreateFilter: true 搜索option 可能会解决您的问题。可能您需要在onClose 中明确postDatafilters(在使用multipleSearch: true 的情况下)或searchString 属性(在使用单字段搜索的情况下):

    $.extend($.jgrid.search, {
        multipleSearch: true,
        recreateFilter: true,
        onClose: function () {
            delete $grid.jqGrid('getGridParam', 'postData').filters;
        }
    });
    

    您可能根本不需要在搜索对话框中加载任何默认过滤器:

    $.extend($.jgrid.search, {
        multipleSearch: true,
        recreateFilter: true,
        loadDefaults: false
    });
    

    一切都取决于您的要求。您应该尝试我上面描述的不同选项,如果搜索对话框不是您需要的,您应该更清楚地描述您的要求。

    【讨论】:

      【解决方案2】:

      要在 jqgrid 的 searchpopup 中重置所有过滤器,请使用 recreateFilter: true

      要在搜索完成后关闭 jqgrid 中的 searchpopup,请使用 closeAfterSearch:true

      jqgrid

      $("#loggerList").jqGrid('navGrid','#pagerDiv',{},{},{},{},
      {closeAfterSearch:true, recreateFilter: true});
      

      HTML

      <div style="padding:10px;">
          <div id="gridContainer">
              <table id="loggerList"></table>
              <div id="pagerDiv"></div>
          </div>
      </div>
      

      【讨论】:

        猜你喜欢
        • 2011-04-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-11-15
        • 2022-11-21
        相关资源
        最近更新 更多