0

I'm modifying an older application that uses JQGrid and I can't seem to figure this out. Dropdownlist image

I have a select box for the filter that contains all the options + ':All' which selecting 'All' will return all results. I have some columns that can be nullable or empty string. How would I append to the searchoptions:{value:":All; value1:Item1; value2:Item2"} so that it would only return the empty or null items when selected and still have the 'All' functionality.

The only thing I can think of is changing the search options to searchoptions:{value:":All; -1:Unassigned; value1:Item1; value2:Item2"} modifying the json to replace '-1' instead of null or empty string... but that isn't clean.

ModestMonk
  • 123
  • 1
  • 1
  • 10
  • Yeah the colon comes before the all because it acts like a wildcard search saying text 'All' but value '' which matches everything. – ModestMonk May 10 '17 at 14:49
  • It seems like a common scenario where I wouldn't need something custom but I just may. One side I want all results, the other I want empty results. So like all or unassigned. – ModestMonk May 10 '17 at 15:52
  • Please include in all questions about jqGrid the information about **the version** of jqGrid, which you use (can use), and about **the fork** ([free jqGrid](), commercial [Guriddo jqGrid]() or an old jqGrid in version <=4.7). Free jqGrid 4.14.0, which I develop, provides `customUnaryOperations` and `customSortOperations` features, which allows to define *custom searching operations*. [The answer](http://stackoverflow.com/a/41445578/315935) provides example of defining of `"is empty"` and `"isn't empty"` unary operations, which you can use to solve your problem. – Oleg May 10 '17 at 19:42
  • You can filtering for the operations "is empty" and "isn't empty" in "Notes" column of [the demo](http://www.ok-soft-gmbh.com/jqGrid/OK/formEditOnDoubleClick-jqueryui-fa3-customUnaryOperations.htm). – Oleg May 10 '17 at 19:44
  • My version of JQGrid is 4.5.4. In your demo, the dropdown 'shipped via': Let's say that column can contain nulls, how would you search for options that do not have a 'shipped via'. – ModestMonk May 12 '17 at 17:55

0 Answers0