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
        });
相关推荐
FreeTinker3 小时前
HTML本地存储技术解析:localStorage与sessionStorage的原理、差异与应用场景
前端·html
qq_452396233 小时前
第十二篇:《全链路监控与可观测性:前端错误追踪与性能分析》
前端
wangruofeng4 小时前
Phosphor Icons 官网源码拆解:URL 即存储、水波动画与 7362 Star 图标库的架构实践
前端·架构·github
BigTopOne4 小时前
WebRTC Native / Android 开发学习资源整理
前端
excel5 小时前
nuxt 3 升级 nuxt 4 报错之 hasInjectionContext
前端
何以解忧,唯有..6 小时前
LangChain 工具调用(Tool Calling)实战指南
java·前端·langchain
软件聚导航7 小时前
「聚小软 AI 助手」技术升级:从数据库检索到 RAG 知识库问答
前端·数据库·mysql·微信小程序·小程序·ai编程·rag
恋猫de小郭7 小时前
看懂大模型架构术语,帮助你理解目前常见的大模型开源架构
前端·人工智能·ai编程
yma167 小时前
通过提示词实现GitHub Pages 和 Nginx 双部署竟然这么简单?
前端
前端 贾公子7 小时前
第09章:上下文与记忆 (2)
java·服务器·前端