Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
604 views
in Technique[技术] by (71.8m points)

javascript - Change filterToolbar options dynamically

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

here is my problem.

  1. initially i need a filter according to the search options as - 'defaultSearch : "eq"

  2. after a button click i need to change the search option as - defaultSearch : "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" .

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...