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) {
                //檢驗格式 電話 辦公室電話  郵箱
            });

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM