JQGrid在特定单元格中单击时不选择行 [英] JQGrid Not select row when clicking in a particular cell
问题描述
在我的jqgrid中,我有一个包含链接的单元格.当前,当用户单击此链接时,已选择了该行(我正在使用多选),我不希望这样做, 当用户在带有链接的特定单元格中单击时,是否可以不选择该行? 我考虑过要进行onCellSelect,然后查看是否已选择当前单元格,并将其设置回单击该单元格之前的状态.不知道这是最好的方法,还是有可能.我找不到一种检查当前行是否被选中的方法,也找不到一种可以更改当前行是否被选中的方法. 任何想法都会有所帮助. 谢谢!
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!
推荐答案
如果我理解您的观点是正确的,则可以使用beforeSelectRow事件处理程序,例如以下代码:
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;
}
从beforeSelectRow
返回false
的值将阻止选择该行.
returning of the false
value from the beforeSelectRow
will prevent selection of the row.
这篇关于JQGrid在特定单元格中单击时不选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!