I need the following behaviors for row selection:
I’ve used the following code and it gives me #2 and #3 but it also selects row regardless of which cell is clicked on in a row.
How can I get #1 to work as part of this code?
multiselect: true,
beforeSelectRow: function (rowid, e) {
var $this = $(this), rows = this.rows,
// get id of the previous selected row
startId = $this.jqGrid(‘getGridParam’, ‘selrow’),
startRow, endRow, iStart, iEnd, i, rowidIndex;if (e.altKey) {
$this.jqGrid(‘resetSelection’);
}if (!e.altKey && !e.shiftKey) {
//$this.jqGrid(‘resetSelection’);
} else if (startId && e.shiftKey) {
$this.jqGrid(‘resetSelection’);// get DOM elements of the previous selected and the currect selected rows
startRow = rows.namedItem(startId);
endRow = rows.namedItem(rowid);
if (startRow && endRow) {
// get min and max from the indexes of the previous selected
// and the currect selected rows
iStart = Math.min(startRow.rowIndex, endRow.rowIndex);
rowidIndex = endRow.rowIndex;
iEnd = Math.max(startRow.rowIndex, rowidIndex);
for (i = iStart; i <= iEnd; i++) {
// the row with rowid will be selected by jqGrid, so:
if (i != rowidIndex) {
$this.jqGrid(‘setSelection’, rows.id, false);
}
}
}// clear text selection
if(document.selection && document.selection.empty) {
document.selection.empty();} else if(window.getSelection) {
window.getSelection().removeAllRanges();
}}
return true;
},
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top