layui table 列宽百分比显示

时间:2019-08-28
本文章向大家介绍layui table 列宽百分比显示,主要包括layui table 列宽百分比显示使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
   var layer = layui.layer, form = layui.form, table = layui.table;
            var $ = layui.$;
            /*select gysmc,zyzw ,xm ,sjhm ,bgshm ,emilyx ,
            zgsrgzwsj ,zggsgl ,cast(gysxxid as int) as gysxxid, pc,
             gysryxxMdataID as ID,sjbs from gysryxxMdata*/
            var tableInit = table.render({
                elem: '#tbgysplay'
                , method: 'post'
                , data: jsonData
                , height: "auto"
                , id: "tbgysplay"
                , text: {none: '暂无相关数据'}
                , toolbar: "#toolbarplan"
                , cols: [[
                    {type: "checkbox", fixed: "left", width: 50}
                    , {
                        field: "number", title: "序号", width: '5%', align: "left", templet: function (data) {
                            return data.LAY_INDEX
                        }
                    }
                    , {field: "ID", title: "ID", align: "left", hide: true}
                    , {field: "action", title: "action", align: "left", hide: true}
                    , {field: "sjbs", title: "sjbs", align: "left", hide: true}
                    , {field: "供应商名称", title: "供应商名称", width: '20%', align: "left"}
                    , {field: "主要产品类型", title: "主要产品类型", width: '20%', align: 'left'}
                    , {field: "所在省份", title: "所在省份", width: '15%', align: 'left'}
                    , {
                        field: "PSA计划时间", title: "PSA计划时间", width: '20%', align: 'left', edit: 'select',
                        templet: function (d) {
                            return '<input type="text" name="rzrq" verify lay-verify="verify" value="' + (d.rzrq || '') + '" placeholder="请选择时间" readonly="readonly" class="layui-input layui-input-date" style="text-align: center"/>';
                        }
                    }
                    , {field: "PSA计划负责人", title: "PSA计划负责人", width: '20%', align: 'left', edit: 'text'}
                ]]
                , done: function () {//当数据渲染完后,执行的回调
                    //日期控件
                    $(".layui-input-date").each(function (i) {
                        layui.laydate.render({
                            elem: this,
                            format: "yyyy-MM-dd",
                            done: function (value, date) {
                                if (res && res.data[i]) {
                                    $.extend(res.data[i], {'rzrq': value})
                                }
                            }
                        });
                    });
                    layer.closeAll();
                }

            });
            //双击编辑行
            table.on('edit(tbgysplay)', function (obj) {
                //检验格式 电话 办公室电话  邮箱
            });

原文地址:https://www.cnblogs.com/luo1240465012/p/11423207.html