JQGrid Do not select row when clicked in a specific cell

In my jqgrid, I have a cell that has a link in it. While the user clicks on this link, a line is selected (I use multiselect). I do not want this. Is there a way not to select a row when the user clicks in this particular cell with a link? I thought about how to make onCellSelect, and then see if the current cell is selected and set it back the way it was clicked. Not sure if this is the best way, or even possible. I cannot find a way to check if the current row is selected, and also cannot find a way to change if a row is selected. Any ideas will help. Thank!

+3
source share
1 answer

If you understand correctly, you can use the beforeSelectRow event handler with the following code, for example:

beforeSelectRow: function(rowid, e) {
    var $link = $('a', e.target);
    if (e.target.tagName.toUpperCase() === "A" || $link.length > 0) {
        // link exist in the item which is clicked
        return false;
    }
    return true;
}

returning a value falsefrom will beforeSelectRowprevent row selection.

+14
source

All Articles