数据拉取过来之后在回调事件done
里根据数据
来做个处理:
table.render({
elem: "#test",
// id: "table_cell_data",
url: "http://localhost:3000/all",
toolbar: "#toolbarDemo", //指向自定义工具栏模板选择器
defaultToolbar: [], //除去打印,导出
title: "用户数据表",
cols: [[ ]],
page: false,
done: function (res, curr, count) {
console.log(res.data);
merge(res);
var that = this.elem.next();
console.log(this.elem)
console.log(that)
res.data.forEach(function (item, index) {
if (item.accstatus === "封禁") {
var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']");
tr.css("background-color", "yellow");
tr.find(".laytable-cell-1-0-9").css("color","red");
}
});
}
});
上效果图: