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
        });
相关推荐
Java展博9 小时前
[前端够用就好] 跨域报错时,浏览器到底在拦谁
前端·状态模式
用户112936112199 小时前
npm 都提示成功了,node_modules 为什么还占着 370M?
linux·前端·后端
掘金安东尼10 小时前
Agent Harness 也有 benchmark:评分榜与评测工作台现状
前端·agent
digger_41910 小时前
从零理解 Electron:主进程、渲染进程、preload 与 IPC 实战
前端·electron
去伪存真11 小时前
别让你的 RAG 平台“花五份钱、答一份结巴的题”:幂等性架构的自我修养
前端·agent
snow@li12 小时前
前端:导入EXCEL并解析文件内容,demo
前端·javascript·vue.js
补码缩写12 小时前
压缩PNG不损失透明:只量化RGB、alpha原样留的减色流程
前端
TDengine (老段)13 小时前
TDengine IDMP 知识库与知识图谱
大数据·前端·物联网·知识图谱·时序数据库·tdengine·涛思数据
goehou14 小时前
PNG 转 WebP 不一定变小,我量了三类图
前端·性能优化·webp·sharp
夕水15 小时前
一个小小的颜色选择器,差点让我开发出一个组件库来
前端·javascript·typescript