working jqGrid Example
HTML
<table id="grid"></table>
JavaScript
var data = [[48803, "DSK1", "", "02200220", "OPEN"], [48769, "APPR", "", "77733337", "ENTERED"],
[32324, "rrrr", "83838383", "ENTER"]];
$("#grid").jqGrid({
beforeSelectRow: function(rowid, e) {
if (!e.ctrlKey && !e.shiftKey) {
$("#grid").jqGrid('resetSelection');
}
else if (e.shiftKey) {
var initialRowSelect = $("#grid").jqGrid('getGridParam', 'selrow');
$("#grid").jqGrid('resetSelection');
var CurrentSelectIndex = $("#grid").jqGrid('getInd', rowid);
var InitialSelectIndex = $("#grid").jqGrid('getInd', initialRowSelect);
var startID = "";
var endID = "";
if (CurrentSelectIndex > InitialSelectIndex) {
startID = initialRowSelect;
endID = rowid;
}
else {
startID = rowid;
endID = initialRowSelect;
}
var shouldSelectRow = false;
$.each($("#grid").getDataIDs(), function(_, id) {
if ((shouldSelectRow = id == startID || shouldSelectRow)) {
$("#grid").jqGrid('setSelection', id, false);
}
return id != endID;
});
}
return true;
},
multiselect: true,
datatype: "local",
height: 250,
colNames: ['Inv No', 'Thingy', 'Blank', 'Number', 'Status'],
colModel: [{
name: 'id',
index: 'id',
width: 60,
sorttype: "int"},
{
name: 'thingy',
index: 'thingy',
width: 90,
sorttype: "date"},
{
name: 'blank',
index: 'blank',
width: 30},
{
name: 'number',
index: 'number',
width: 80,
sorttype: "float"},
{
name: 'status',
index: 'status',
width: 80,
sorttype: "float"}
],
caption: "Stack Overflow Example",
// ondblClickRow:...