Free jqGrid allows to define custom searching/filtering operation with respect of customSortOperations
option. By default the corresponding custom compare operation will have two operands. Unary operations should be specified in customUnaryOperations
option additionally. The feature is initially described in the wiki article. One can find some examples of usage the feature on the stackoverflow.
The custom compare/filter operators defined in customSortOperations
need be included in the definition of the corresponding column in the array searchoptions.sopt
. The demo uses the following code:
colModel: [
...
{ name: "name", align: "justify", width: 87, editrules: { required: true },
autoResizing: { minColWidth: 87 },
createColumnIndex: true,
searchoptions: {
generateDatalist: true,
sopt: [ "cn", "em", "nm", "in", "ni",
"teq", "tne",
"eq", "bw", "ew", "bn", "nc", "en" ],
clearSearch: true
} },
...
],
customUnaryOperations: ["em", "nm"],
customSortOperations: {
em: {
operand: "=''",
text: "is empty",
filter: function (options) {
var v = options.item[options.cmName];
if (v === undefined || v === null || v === "") {
return true;
}
}
},
nm: {
operand: "!=''",
text: "isn't empty",
filter: function (options) {
var v = options.item[options.cmName];
if (v !== undefined && v !== null && v !== "") {
return true;
}
}
},
teq: {
operand: "==",
text: "Turkish insensitive \"equal\"",
filter: function (options) {
var fieldData = String(options.item[options.cmName]).replace(/i/g,'İ').toUpperCase(),
searchValue = options.searchValue.replace(/i/g,'İ').toUpperCase();
return fieldData === searchValue;
}
},
tne: {
operand: "!=",
text: "Turkish insensitive \"not equal\"",
filter: function (options) {
var fieldData = String(options.item[options.cmName]).replace(/i/g,'İ').toUpperCase(),
searchValue = options.searchValue.replace(/i/g,'İ').toUpperCase();
return fieldData !== searchValue;
}
}
},
The code defines 4 custom operations: "em", "nm", "teq", "tne", where "em" ("is empty") and "nm" ("isn't empty") are unary operations. I get the code from my old answers: this one and another one.
The custom operations are available in searching toolbar and in the searching dialog:

I think it's the feature, which you need. I'd recommend you additionally to read another answer, which is close to your requirements. I think that simple modification of the code could solve your problem.