动态更改过滤器工具栏选项 [英] Change filterToolbar options dynamically

查看:27
本文介绍了动态更改过滤器工具栏选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以动态设置 'filterToolbar' 选项?

Is there any way that i can set 'filterToolbar' options dynamically?

这是我的问题.

  1. 最初我需要根据搜索选项的过滤器 - 'defaultSearch : "eq"

单击按钮后,我需要将搜索选项更改为 - defaultSearch : "cn"

after a button click i need to change the search option as - defaultSearch : "cn"

一种方法可以动态设置 defaultSearch 选项(我不知道天气是否可行),另一种方法是删除旧的 filtertoolbar 并添加新的 filtertoolbar 默认搜索为cn";.

one approach could be set the defaultSearch option dynamically ( i don't know weather it is possible) and other would be remove the old filtertoolbar and add the new filtertoolbar with the defaultsearch as "cn" .

jqgrid 可以做到这一点吗?请告诉我.感谢你的帮助.提前谢谢你.

is this possible with the jqgrid? please let me know. appreciate your help. Thank you in advance.

推荐答案

我觉得你的问题很有趣,所以在我 +1 之前.

I find your question interesting so before all +1 from me.

filtertoolbardefaultSearch参数的值不能改变,但是可以动态改变:

You can't change the value of defaultSearch parameter of filtertoolbar, but you can change dynamically:

$("#list").jqGrid('setColProp','name',{searchoptions:{sopt:['cn']}});

演示中客户端"中的初始搜索选项defaultSearch 定义的列,为cn".通过单击网格上方的两个按钮,您可以将选项更改为bw"(开头)或ew"(结尾).您可以在演示中轻松验证该方式是否有效.

In the demo the initial searching option in the 'Client' column defined by defaultSearch and is 'cn'. By clicking on two buttons above the grid you can change the option to 'bw' (begin with) or 'ew' (end with). You can easy verify on the demo that the way work.

这篇关于动态更改过滤器工具栏选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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