layui table 详细讲解

复制代码
 1  layui.use('table', function () {
 2             var table = layui.table;
 3             /*第一种原始写法*/
 4             /*
 5             table.render({
 6                 id: 'laydictsList',
 7                 elem: '#test',
 8                 url: areasURL + "/base_dics/LayuigetPageList",
 9                 cellMinWidth: 80,//全局定义常规单元格的最小宽度,layui 2.2.1 新增
10                 where: { txtFullName: null },
11                 page: true,
12                 //toolbar:'barDemo',
13                 limit: 10,
14                 limits: [2, 5, 10, 20, 30],
15                 text: {
16                     none: '暂无相关数据!'//默认无数据
17                 },
18                 cols: [[
19                   { type: 'checkbox', LAY_CHECKED: false },
20                   { field: 'dicsid', width: 80, title: 'ID', sort: true, hide: true },
21                   { field: 'code', width: 80, title: '编号' },
22                   { field: 'sortnum', width: 80, title: '序号', sort: true },
23                   { field: 'fullname', width: 80, title: '名称' },
24                   { field: 'diccategoryname', title: '所属类别', width: '30%', minWidth: 100 }, //minWidth:局部定义当前单元格的最小宽度,layui 2.2.1 新增
25                   { field: 'experience', title: '操作' }
26                 ]]
27             });
28         });
29         */
30             /*第二种改进版*/
31             table.render({
32                 id: 'laydictsList',
33                 elem: '#test',
34                 url: areasURL + "/base_dics/getPageList",
35                 method: "post",
36                 request: {
37                     pageName: 'PageNum', //页码的参数名称,默认:page
38                     limitName: 'PageSize' //每页数据量的参数名,默认:limit
39                 },
40                 response: {
41                     statusName: 'ReturnType', //数据状态的字段名称,默认:code
42                     statusCode: true,//成功的状态码,默认:0
43                     msgName: 'ReturnMsg', //状态信息的字段名称,默认:msg
44                     countName: 'ReturnCount', //数据总数的字段名称,默认:count
45                     dataName: 'ReturnData', //数据列表的字段名称,默认:data
46                 },
47                 cellMinWidth: 80,//全局定义常规单元格的最小宽度,layui 2.2.1 新增
48                 where: { txtFullName: null },
49                 page: true,
50                 //toolbar:'barDemo',
51                 limit: 10,
52                 limits: [2, 5, 10, 20, 30],
53                 text: {
54                     none: '暂无相关数据!'//默认无数据
55                 },
56                 cols: [[
57                   { type: 'checkbox', LAY_CHECKED: false },
58                   { field: 'dicsid', width: 80, title: 'ID', sort: true, hide: true },
59                   { field: 'code', width: 80, title: '编号' },
60                   { field: 'sortnum', width: 80, title: '序号', sort: true },
61                   { field: 'fullname', width: 80, title: '名称' },
62                   { field: 'diccategoryname', title: '所属类别', width: '30%', minWidth: 100 }, //minWidth:局部定义当前单元格的最小宽度,layui 2.2.1 新增
63                   { field: 'experience', title: '操作' }
64                 ]]
65             });
66         });
复制代码

 

posted @   每天进步多一点  阅读(7334)  评论(0编辑  收藏  举报
编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤
历史上的今天:
2019-11-26 Oracle批量、大量Update方法总结
2019-11-26 Gridview中的编辑模板与项模板的用法
2017-11-26 Sql Server合并多行询数据到一行:使用自连接、FOR XML PATH('')、STUFF或REPLACE函数
2017-11-26 net中的4种事务总结
2017-11-26 解决微信OAuth2.0网页授权回调域名只能设置一个的问题
2017-11-26 js中window.location.search的用法和作用。
2016-11-26 ReportViewer中设置ServerReport.ReportServerCredentials属性的方法
点击右上角即可分享
微信分享提示