views:

499

answers:

2

So I'm using jqGrid with my mvc.net / Ling2Sql prototype site that I'm making and I've done the work to get jqGrids search functionality up and running. Its pretty sweet actually, but since you cant search by >, >=, < or <= with strings, I wanted to setup the search options per column.

I know I can set the overall search options for the table by doing:

jQuery("#search").searchGrid( {sopt:['cn','bw','eq','ne','lt','gt','ew']} );

But I want something on a per column basis, so the user maintains the ability to search >, >=, < and <= on int columns but not on string columns.

On a whim I tried this and it didn't work

<snip>
colNames:['Id', 'form2', 'form3'],
colModel:[
 {name:'ID',    index:'FormID', width:20, sopt:['ne','lt']},
 {...},
 {...}
 ]
<snip>

I'm going to guess I'd have to dive fairly deep into jqGrid to add this functionality, but I just wanted to see if it wasn't an option already built in.

+1  A: 

Allen, I know it's been awhile, but Tony just released jqgrid 3.5 out of beta, so you might want to upgrade...

If you look at the wiki page for colModel (which probably assumes 3.5), then the option "searchoptions:[sopt[...]]" is what you'll want to use.

Try it out with 3.4.4...

r00fus
A: 

Given that particular version, there is no way to do it without diving somewhat deeper into the codebase and adding functionality.

Allen