自定义layui动态渲染的数据表格单元格样式

layui.use('table', function() {
        var table = layui.table;

        table.render({
            elem: "#table",
            url: "{:url('xxxx')}",
            page: true,
            done: function(res) {
            },
            cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
                {field: 'xx', title: 'xx',  sort: true,width: 120, align: 'center'},
                {field: 'xx', title: 'xx',  sort: true,width: 120, align: 'center'},
                {field: 'xx', title: 'xxx',  sort: true,width: 180, align: 'center'},
                {field: 'xx', title: 'xx', style:'color:red', sort: true,width: 180, align: 'center'},
                {title: '操作', width: 120, align: 'center', templet: '#operation'}
            ]]
        });
    
        // 监听工具栏
        table.on('tool(table)', function(o) {
            var d   = o.data,
                lEv = o.event,
                tr  = o.tr
            
            if (lEv == 'detail') pop(d);
            if (lEv == 'deleted') deleted(d);
        })
    });

相关文章:

  • 2021-04-24
  • 2021-12-28
  • 2021-12-05
  • 2021-05-28
  • 2022-01-11
  • 2021-11-09
猜你喜欢
  • 2021-11-28
  • 2021-12-05
  • 2021-11-15
  • 2021-05-12
  • 2022-12-23
  • 2021-07-26
  • 2021-12-31
相关资源
相似解决方案