jqGrid-like search module?
I really like the multiple search option the jqGrid has, but there's one small problem with it. I can't make any search options more complicated than a list of AND or OR statements. I can't do anything like cnd1 AND (cnd2 OR cnd3), I'm limited to cnd1 OR cnd2 OR cnd3.
Is anyone aware of a search plugin or script that allows this? The jqGrid search is simple to use and understand, it just has the aforementioned issue. I don't even care if it interfaces with a table or makes ajax requests or anything; I'm just interested in finding some easy interface I can present to users so they can construct more complicated filter conditions for开发者_开发技巧 the query.
I thought of making one myself by having a similar list of condition specifications, and then allowing the user to bunch a number of conditions together into a group and all the conditions in the group are connected by the same boolean type (AND/OR). And then the user can group together groups, which allows more complicated search conditions.
So an example would be grp1 AND grp4. grp1 is just cnd1. grp4 is grp2 OR grp3. grp2 is cnd2 AND cnd3. grp3 is cnd4 AND cnd 5. So in the end, the statement is cnd1 AND ((cnd2 AND cnd3) OR (cnd4 AND cnd5)). But all this seems very complicated to present on the screen.
So anyway, does anyone know of some solution that exists already that accomplishes what I'm looking for (without requiring the user to actually write out their query of course)? Does this even make sense?
Thanks
In the next version of jqGrid the old jquery.searchFilter.js module will be replaced with the new one grid.filter.js which will produce filters
compatible with the old format, but it will allows full freedom in the grouping which you asked.
Look at the demo which use some more new grid.filter.js (not the last version). I created the demo for the answer. It use not the last version of the grid.filter.js, but it shows the main difference to the advanced searching.
More about the new filter you can read here. By the way 3 hours ago Tony added templates feature in filter module. You can find the code on the github.com (see here the last changes)
I think the new grid.filter.js will solve your requirements and you don't need to spend your time in writing you own plugin.
Does the jqGrid Advanced Search provide what you are looking for? To see a demo head to this link and go under:
New in Version 3.5 > Advanced Searching
Although you cannot necessarily type the search you are looking for, it does give finer control over the search. (And, you can simulate AND and OR within the search giving you a similar kind of search that you are looking for.)
精彩评论