Layui Table组件,设置data数据源,以及page为False,表格只能显示10条数据的问题

代码如下:

javascript 复制代码
//显示表个数据
        table.render({
            elem: '#' + tableId
            , height: 350
            , page: false // 开启分页
            , skin: 'row' // 行边框风格
            , even: true // 开启隔行背景
            , defaultToolbar: ['filter']
            , toolbar: '#active' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
            , cols: [[
                {field: 'id', title: 'ID', hide: true},
                {field: 'warehouseName', title: '库位', align: 'center', minWidth: 150},
                {field: 'warehouseReleaseDate', title: '预约出仓日期', align: 'center', width: 300},
                {fixed: 'right', title: '操作', align: 'center', toolbar: '#action', width: 150}
            ]],
            data: tableData,
        });

测试中,发现tableData数据大于10条时,表格依然只展示10条数据。后面查layui文档,才发现即是设置page为false时,外面的limit参数依然生效。

解决方法

增加limit配置即可。

javascript 复制代码
 //显示表个数据
        table.render({
            elem: '#' + tableId
            , height: 350
            , page: false // 开启分页
            , skin: 'row' // 行边框风格
            , even: true // 开启隔行背景
            , defaultToolbar: ['filter']
            , toolbar: '#active' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
            , cols: [[
                {field: 'id', title: 'ID', hide: true},
                {field: 'warehouseName', title: '库位', align: 'center', minWidth: 150},
                {field: 'warehouseReleaseDate', title: '预约出仓日期', align: 'center', width: 300},
                {fixed: 'right', title: '操作', align: 'center', toolbar: '#action', width: 150}
            ]],
            data: tableData,
            limit: tableData.length
        });
相关推荐
啷咯哩咯啷2 分钟前
Vue3构建低代码表单设计器
前端·javascript·vue.js
用户26124583401613 分钟前
vue学习路线(10.监视属性-watch)
前端·vue.js
Spider_Man4 分钟前
React-Router 全面解析与实战指南
前端·react.js
凌览5 分钟前
斩获 27k Star,一款开源的网站统计工具
前端·javascript·后端
丘耳6 分钟前
前端渲染方式
前端
The_cute_cat6 分钟前
Ajax和Axios的初步学习
前端·学习·ajax
Zz_waiting.7 分钟前
Javaweb - 10.4 ServletConfig 和 ServletContext
java·开发语言·前端·servlet·servletconfig·servletcontext·域对象
爱学习的小学渣8 分钟前
JS用法:Map,Set和异步函数
前端·javascript
Mike_jia15 分钟前
Icinga 2:开源监控领域的全能选手——从零构建企业级智能运维体系
前端
wuxuanok17 分钟前
Web前端开发-HTML、CSS
前端·css·html