单击按钮时避免使用onClickRow表引导程序

问题描述 投票:1回答:1

每次我点击列中的按钮时都会出现问题,onClickRow会在表boostrap中触发,如果您单击列中的按钮,我想避免这种情况。

bootstrap-4 bootstrap-table
1个回答
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;

        }
    }

因此,如果该领域正在运作,它将不会做任何事情。

© www.soinside.com 2019 - 2024. All rights reserved.