jQgrid工具栏搜索 - 从任何列动态删除搜索框 [英] jQgrid toolbar searching - dynamically remove search box from any column

查看:236
本文介绍了jQgrid工具栏搜索 - 从任何列动态删除搜索框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqgrid版本4.4.4,现在我面临与工具栏搜索相关的一个问题。正如我在标题中提到的,我希望在渲染网格期间或之后从任何列动态中删除工具栏搜索的搜索框。我谷歌它但我没有找到任何相关的解决方案我的这个问题。
我用 selColProp 这样的属性

I am using jqgrid version 4.4.4 and right now I am facing one problem related to toolbar searching. As I mention in heading, I want remove search box of toolbar search from any column "dynamically" during or after rendering a grid. I google it but I didn't found any relevant solution on my this problem. I used selColProp property like this

$('#<gridId>').jqGrid('setColProp', 'LotNo', {
    search: false
});

并在 loadcomplete 函数中提及逻辑原因。
如果有人知道如何做到这一点,请分享您的宝贵意见。

and mentioned in loadcomplete function due to some logical reason. If anyone knows how to do this, kindly share your valuable ideas.

更新:现在我使用免费的jqgrid版本4.9.2,此功能也没有发生在它上面。

UPDATED: Now I am using free jqgrid version 4.9.2 and this functionality also not happening on it.

推荐答案

搜索工具栏将创建一次。它包括搜索工具栏中的所有可搜索列。如果您需要动态更改搜索属性 ,则必须在更改 search <的值后重新创建搜索工具栏/ code> property。您只需要调用 destroyFilterToolbar 删除搜索工具栏,然后再次调用 filterToolbar

Searching toolbar will be created once. It includes all searchable columns in the searching toolbar. If you need to change the search property dynamically then you have to recreate the searching toolbar after changing the value of search property. You need just call destroyFilterToolbar to remove the searching toolbar and then call filterToolbar once more time.

或者,您可以考虑将搜索属性设置为 false 。相应的代码可能类似于

Alternatively you can consider just to hide the searching field after setting the search property to false. The corresponding code could be something like

$("#gs_LotNo").closest(".ui-search-table").hide();

字符串 gs_LotNo LotNo 列的输入字段。并使用 $(#gs_LotNo)。nearest(。ui-search-table)你得到的外表包含可选的搜索菜单和 x 按钮。您可以考虑在隐藏之前使该字段的内容为空( $(#gs_LotNo)。val())以确保当前值为输入字段不会在过滤器中使用。

The string gs_LotNo is the id of the input field of the LotNo column. and using $("#gs_LotNo").closest(".ui-search-table") you get the outer table which contains optional searching menu and x button. You can consider to make the content of the field empty ($("#gs_LotNo").val("")) before hiding to be sure that the current value in the input field will not be used in filters.

这篇关于jQgrid工具栏搜索 - 从任何列动态删除搜索框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆