繁体   English   中英

检查动态Bootstrap表中的类

[英]Check dynamic Bootstrap Table for class

所以我有这张桌子

<table id="table" class="table table-bordered table-hover">
    <thead>
        <tr>
            <th data-field="id" class="hidden">ID</th>
            <th data-field="variant">Variant</th>
            <th data-field="description">Description</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

它将充满数据槽

$('#table').bootstrapTable({
    data: returnValue
});

然后我可以单击将类添加到.bg-info的行,我想检查某行是否具有该类,然后将行数据保存在var

这是我的尝试:

var item = $.map(table.rows('.bg-info').data(), function (item) {
    return item[0]
});

但是table.rows显然不能用作方法

如果要在表中选择类bg-info所有行。 使用基于该类的jQuery选择器:

var bgInfoRows = $("#table tbody .bg-info");

您将在tbody中拥有类bg-info所有项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM