JQGrid Not select row when clicking in a particula

2019-02-15 07:41发布

问题:

In my jqgrid, I have a cell that has link in it.Currently when the user clicks this link the row is selected (I am using multiselect) I don't want this, Is there a way to not select the row when the user click in this particular cell with the link? I have thought about doing a onCellSelect and then seeing if the current cell is selected and setting it back to the way it was before the cell was clicked. Not sure if this is the best way, or it is even possible. I can't find a way to check if the current row is selected, nor can I find a way to change if a row is selected or not. Any ideas would help. Thanks!

回答1:

If I understand you correct you can use 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 of the false value from the beforeSelectRow will prevent selection of the row.



标签: jquery jqgrid