我有一个问题,原因是每次我单击列内的按钮时,都会在表boostrap中触发onClickRow,如果您单击列内的按钮,我想避免这种情况。
答案 0 :(得分:1)
我为正在使用表引导程序并且希望排除onClickRow事件的一个字段(例如带有按钮的列)的人编写此代码。
如我在此处所示,如果将按钮所在的字段称为“操作”或“任何内容”:
var myColumns = [
[
{
field: 'operate',
rowspan: 2,
align: 'center',
}
]
您可以这样做:
onClickRow: function (row, $element, field) {
// row: the record corresponding to the clicked row,
// $element: the tr element.
if (field !== 'operate') {
window.location = someUrl;
}
}
因此,如果该字段处于可操作状态,则不会执行任何操作。