layui根据条件让一行数据变色 以及单元格update

  done: function (res, page, count) {
            var that = this.elem.next();
            console.log(that)
            res.data.forEach(function (item, index) {
                if (item.count >= 260) {
                    var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#FF0000");
                } else if (item.count >= 220) {
                    var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#FFA500");
                } else if (item.count >= 180) {
                    var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#ffff00");
                }
            });
        }
 // 表格编辑 监听单元格编辑   update
                table.on('edit(scanDetail)', function (obj) {
                    obj.update({
                        hotelName: obj.value
                    });
                });

猜你喜欢

转载自blog.csdn.net/qq_42267888/article/details/83445384