How to have checkbox be toggled on “checkbox” column only, so row select don't toggle checkbox

人盡茶涼 提交于 2019-12-11 09:57:45

问题


I'm using multiselect: true option on jqGrid setup.

The issue I'm having is when I click on any row, the checkbox get toggled. How do I limit the toggling of checkbox to "checkbox" column only when clicking on that "checkbox" column. I don't want the checkbox to be checked/unchecked when I click on 3rd column, 5th column, etc.

Is that possible?


回答1:


The callback beforeSelectRow allows to define specific rules for selection the row. It should return false to prevent the selection. The checkboxes from multiselect column have CSS class "cbox". Thus the callback

beforeSelectRow: function (rowid, e) {
    return $(e.target).hasClass("cbox");
}

should solve the problem.



来源:https://stackoverflow.com/questions/33402515/how-to-have-checkbox-be-toggled-on-checkbox-column-only-so-row-select-dont-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!