var myData = [{
id: 1,
name: "one two three"
}, {
id: 2,
name: "two three"
}, {
id: 3,
name: "one three"
}, ];
$("#list").jqGrid({
datatype: "local",
colNames: ["Name"],
colModel: [{
name: "name",
index: "name",
searchoptions: {
sopt: ["sIn", "bw", "cn", "lt", "le", "gt", "ge", "in", "ni"]
}
}],
caption: "Viz Test",
pager: '#pager',
search: true,
multiselect: true,
data: myData,
customSortOperations: {
// the properties of customSortOperations defines new operations
// used in postData.filters.rules items as op peroperty
sIn: {
operand: "sIN", // will be displayed in searching Toolbar for example
text: "String IN", // will be shown in Searching Dialog or operation menu in searching toolbar
title: "Type multiple values separated by space to search for one from the specified values",
filter: function (options) {
// The method will be called in case of filtering on the custom operation "nIn"
// All parameters of the callback are properties of the only options parameter.
// It has the following properties:
// item - the item of data (exacly like in mydata array)
// cmName - the name of the field by which need be filtered
// searchValue - the filtered value typed in the input field of the searching toolbar
var fieldData = options.item[options.cmName];
var words = options.searchValue.split(" ");
$.each(words, function () {
var searchResults = fieldData.search(this)
//alert(searchResults);
if (searchResults < 0) {
fieldData = "";
}
});
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.