Jquery JQGrid:取消选择事件

Jquery JQGrid:取消选择事件,jquery,events,jqgrid,Jquery,Events,Jqgrid,使用JQGrid,我知道当选择一行时onsetrow事件 我想知道当您因为选择了另一行而取消选择某一行时是否会发生事件 谢谢您仍然可以创建自定义活动: onSelectRow: function (id) { if (this.lastSel && id && id !== this.lastSel) { $(this).trigger('deselectRow', [this, this.lastSel]);

使用JQGrid,我知道当选择一行时onsetrow事件

我想知道当您因为选择了另一行而取消选择某一行时是否会发生事件


谢谢

您仍然可以创建自定义活动:

onSelectRow: function (id) {
        if (this.lastSel && id && id !== this.lastSel) {
            $(this).trigger('deselectRow', [this, this.lastSel]);
        }
        this.lastSel = id;
    }
然后绑定事件:

$("#grid").on('deselectRow', function(e, table, rowId){
    console.log(rowId); // $('#'+rowId, table);
});

值得一提的是,此方法仅在选择另一行时有效,而在第二次单击同一行取消选择时无效。