Last Updated: February 25, 2016
·
4.085K
· redcomet

jqGrid: Making a row a link

Had a situation where I wanted the user to double click on a row to view details of the item. This makes the row appear as a 'link' by setting the cursor to pointer and disables all selection so even if they click and drag they don't see the annoying blue highlight.

 .pointer {
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

$('#grid').jqGrid({
    rowattr: function (rd) { return { 'class': 'pointer' }; },
    beforeSelectRow: function(){ return false; },
    ondblClickRow: function (rowid) {
        var rowData = $(this).getRowData(rowid);
        document.location.href = "controller/action/" + rowData['Id'];
    }
});