JavaScript
var serverResponse = {
"page": 1,
"total": 1,
"records": 4,
"rows": [{
"id": 941,
"cell": [357967, false, "Z357967", 1]
}, {
"id": 940,
"cell": [357963, false, "Z357963", 1]
}, {
"id": 939,
"cell": [357967, false, "Z357967", 5]
}, {
"id": 938,
"cell": [357967, false, "Z357967", 6]
}]
},
containsOrNot = 'contains',
$grid = $("#list"),
lastsel2 = '';
$.extend($.jgrid.search, {
multipleSearch: true,
multipleGroup: true,
recreateFilter: true,
closeOnEscape: true,
closeAfterSearch: true,
overlay: 0
});
$grid.jqGrid({
url: "/echo/json/", // use JSFiddle echo service
datatype: "json",
postData: {
json: JSON.stringify(serverResponse) // needed for JSFiddle echo service
},
mtype: 'POST',
colNames: ['id', 'Select Labels to Print', 'Item Number', 'Quantity'],
colModel: [{
name: 'I_PK',
index: 'u.I_PK',
align: 'right',
editable: false,
sopt: ['cn', 'eq', 'ne', 'lt', 'le', 'gt', 'ge', 'bw', 'ew', 'nc']
}, {
name: 'W3LabelSelected',
index: 'u.W3LabelSelected',
align: 'center',
width: 170,
editable: false,
edittype: 'checkbox',
formatter: "checkbox",
search: false,
formatoptions: {
disabled: false
},
editoptions: {
value: "1:0"
}
}, {
name: 'I_ItemNumID',
index: 'u.I_ItemNumID',
align: 'right',
editable: true,
editoptions: {
dataEvents: [{
type: 'focusin',
fn: function (e) {
var elem = e.target;
setTimeout(function () {
elem.select();
}, 50);
}
}]
}
...