直接上代码:
layui数据表格部分代码
, page: true //是否显示分页
, limits: [10, 20, 50, 100]
, limit: 10 //每页默认显示的数量
, id: "tableReload"
, where: {}
, text: {
none: '暂无相关数据'
},
done:function (res, curr, count) {
var data = res.data;
var allck = true;
//遍历 表格数据所有行 有一行状态为0 则不能全选
for (var item in data) {
if (data[item].status == 0) {
allck = false;
break;
}
}
if (!allck) { //为0 不可全选
$(".layui-table-header").find("input[name = 'layTableCheckbox'][lay-filter='layTableAllChoose']").each(function() {
$(this).attr("disabled", 'disabled').next().removeClass("layui-form-checked");
form.render('checkbox');
});
}
i = 0;
//遍历表格所有行 改行状态为0 则选择框不可选
$(".layui-table-fixed.layui-table-fixed-l").find(".layui-table-body").find("input[name='layTableCheckbox']").each(function() {
if (res.data[i].status == 0) {
$(this).attr("disabled", 'disabled').removeAttr("checked");
form.render('checkbox');
}
i++;
});
}