所以我想在表行中添加一个类(标题除外),但我不知道该怎么做。有人知道我该怎么做吗?
这是我的 table :
<table id="table" class="hidden table table-bordered table-striped table-hover">
<thead>
<tr>
<th data-field="variant">Variant</th>
<th data-field="description">Description</th>
</tr>
</thead>
</table>
这是当前我添加数据并希望将类添加到行的位置
$('#table').bootstrapTable({
data: returnValue
});
最佳答案
查看 Bootstrap 表文档并使用行样式属性, 我不熟悉那个插件,但我想它应该是这样的
$('#table').bootstrapTable({
data: returnValue,
rowStyle : function(row, index) {
return {
classes: 'text-nowrap another-class',
css: {"color": "blue", "font-size": "50px"}
};
}
});
在此处阅读文档 http://bootstrap-table.wenzhixin.net.cn/documentation/
关于javascript - 将类添加到动态 Bootstrap 表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45499723/