JQGrid Not select row when clicking in a particula

2019-02-15 07:18发布

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!

标签: jquery jqgrid
1条回答
对你真心纯属浪费
2楼-- · 2019-02-15 08:22

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.

查看更多
登录 后发表回答