加载完表格后处理,

 tableIns = table.render({
                elem: '#tableDemo',
                url: '/pltTaskInfo/getDataByCondition',
                toolbar: '#toolbarDemo',
                cols: [cols],
                defaultToolbar: ['filter'],
                height: 'full-80',
                page: {
                    limit: TableUIObj.onePageRecoeds,
                    limits: [10, 20, 30, 40, 50]
                },
                where: {
                    pltId: pltId,
                    deptId: deptId,
                    orderbyFields: upperFieldMatch(TableUIObj.orderbyFields),
                    orderbyUpdown: TableUIObj.orderbyUpdown
                },
                autoSort: false,
                parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": 0, //解析接口状态
                        "data": res.data, //解析数据列表
                        "count": res.totleNum, //解析数据长度
                    };
                },
                request: {
                    limitName: 'pageSize' //每页数据量的参数名,默认:limit
                },
                done: function (res) {
                    if(pltType == '01'){
                        $('#add').hide();
                    }else{
                        $('#import').hide();
                        //隐藏某一列
                        $("[data-field='controlLevel']").css('display','none');
                    }
        })

或者

layui数据表格中隐藏列方式,如果直接在定义列时隐藏: taskNo: {field: 'taskNo', title: '编码', sort: true, hide: true},

var colShowObj = {
            taskNo: {field: 'taskNo', title: '编码', sort: true, hide: true},
            controlLevel: {
                field: 'controlLevel', title: '关注等级', sort: true, hide: false, templet: function (d) {
                    return dictionaryObj['CONTROL_LEVEL']['object'][d.controlLevel] || ''
                }
            },
        }

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐