我有一个带有添加新数据行按钮的Bootstrap-Table。我想为每个新插入的行中的某一列(text2)着色。我使用内置方法
cellStyle()
,如此处所示:http://jsfiddle.net/wenyi/e3nk137y/9/,但是该函数从未被调用。
Bootstrap-Table文档:http://bootstrap-table.wenzhixin.net.cn/documentation/
带有cellStyle参数的表声明:
<table id="table" data-pagination="true" data-cell-style="cellStyle" class="table table-striped"></table>
添加样式的函数:
function cellStyle(value, row, index, field) {
if (index === 0 && field == 'text2') {
return {classes: 'warning'};
}
else {
return {};
}
}
我的完整代码: