标签:cto val tst use HERE call 传参 页面 分页
 layui.use([‘table‘,‘layer‘], function () {
                var $ = layui.jquery, layer = layui.layer;
                var table = layui.table;
                var txtRet = document.getElementById("<%= txt_RegName.ClientID %>");
                var tableIns = table.render({
                    elem: ‘#idTest‘
                    , height: 500
                    , url: ‘/Hander/VehicleReport.ashx‘ //数据接口
                    //, data: { "vehicleId": vehicleId }
                    //,where:{
                    //    RegName: txtRet.value
                    //}
                    , page: true //开启分页
                    , id: ‘testReload‘
                    , cols: [[ //表头
                        { title: ‘序号‘, field: ‘rownumber‘ }
                        , { field: ‘RegName‘, title: ‘车牌号‘}
                        , { field: ‘DriverName‘, title: ‘司机‘ }
                        , { field: ‘StatusStr‘, title: ‘状态‘ }
                        , { field: ‘InStationTime‘, title: ‘进站时间‘  }
                        , { field: ‘OutStationTime‘, title: ‘出站时间‘}
                        , { field: ‘StationName‘, title: ‘中转站名称‘ }
                        , { field: ‘InFactoryTime‘, title: ‘进厂时间‘}
                        , { field: ‘OutFactoryTime‘, title: ‘出厂时间‘ }
                        , { field: ‘FactoryName‘, title: ‘工厂名称‘}
                    
                    ]]              
                });
                $(‘.layui-btn‘).on(‘click‘, function () {
                    var type = $(this).data(‘type‘);
                    active[type] ? active[type].call(this) : ‘‘;
                });
                var active = {
                    reload: function () {
                        //执行重载
                        tableIns.reload({
                            page: {
                                curr: 1 //重新从第 1 页开始
                            }
                          , where: {
                              RegName: txtRet.value
                          }
                        });
                    }
                };
代码是这样,传参使用一般处理程序接收,接收不到是因为此页面引用母版页,获取不到真实的ID,需要document.getElementById("<%= txt_RegName.ClientID %>").value去赋值
重载两次是因为搜索用的是button,改成<a class="layui-btn" data-type="reload">搜索</a>就可以了,虽然不知道是什么原因
标签:cto val tst use HERE call 传参 页面 分页
原文地址:https://www.cnblogs.com/DoudouZhang/p/9071151.html