欢迎来到 万图素材
帮助中心

万图素材

layui在table表格中添加时间控件

摘要:layui在table表格中添加时间控件

timeB为name   

layui.table.render({
                elem: '#lay-purchasing-change',
                     id: "layTableId1"   ,
                url: baseURL + 'purchase/erpPruchasingOver/info/' + data.purchasingOverId,
                method: 'POST'
                , where: {}
                , contentType: "application/json;charset=utf-8"
                //数据接口 //数据接口/info/{purchasingOrderId}
                , cols: [[ //表头
                    // {type:'checkbox'}
                    {field: 'timeA', title: '付款时间', align: 'center', width: 260},
                    {field: 'moneyA', title: '付款金额(元)', align: 'center', width: 260},
                    {field: 'timeB', title: '待修改时间', align: 'center', width: 260, edit: 'select',
                        templet: function (d) {
                            return '<input type="text" name="timeB" verify lay-verify="verify" value="' + (d.timeB || '') + '" placeholder="请选择时间" readonly="readonly" class="layui-input layui-input-date" style="text-align: center"/>';
                        }},
                    {field: 'moneyB', title: '待修改金额(元)', align: 'center', width: 260 ,edit: 'text'},
                ]],
                done: function (res, curr, count) {
                    //日期控件
                    $(".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], {'timeB': value})
                                }
                            }
                        });
                    });
                    console.log(res);
                },
                page: false,
                loading: true
            });

商品评价(0)

后面还有条评论,点击查看>>
联系我们
Q Q:3078847178
电话:3078847178
时间:09:00 - 19:00
地址:广东省清远市清城区百家大街101号