深圳全飞鸿
标题:
layui在table的render
[打印本页]
作者:
zhgc
时间:
2023-3-31 21:18
标题:
layui在table的render
elem: 这里是我们前端定好的table的id,直接写上就行
method:请求方式
url: 接口的地址
cols : 多少列
type: 有多种选择,type:number ,也可以,具体可以看官网,
checkbox 是多选框,layui 也是有方法可以监听的,
table.on('checkbox(newCompanyTable)', function (obj) { console.log(obj)}) 可以打印出来就知道效果
field: 是根据接口的data的数据来的,field 等于data的属性名就可以取到对应的属性值了,
title: 就是表格的标题了
align: 对齐方式
toolbar:是可以在HTML里面写模板,用script包裹的一个代码片段
table.render({
elem: '#testTable' //我们需要渲染table
, method: "POST"
, url: '/Admin/NewCompany/theListData' //模拟接口
, cols: [[
{ type: 'checkbox', width: 30, align: 'center' },
{ field: 'co_id', width: 60, title: '机构ID', align: 'center'} ,
{ title: '操作', width: 80, align: 'center', toolbar: '#table-system-order' }
]]
, page: true
, limit: 10
, limits: [10, 15, 20, 25, 30]
, done: function (curr, limit) {
//console.log(this.page.curr, this.page.limit);
}, text: {
none: '暂无相关数据' //默认:无数据。注:该属性为 layui 2.2.5 开始新增
}
});
作者:
zhgc
时间:
2023-3-31 21:21
table的数据结构
{
"code": 0
,"msg": ""
,"count": "100"
,"data": [{
"orderid": 111
,"title": "移动"
,"attr": "公告"
,"progress": "25%"
,"submit": "贤心"}]
}
复制代码
作者:
zhgc
时间:
2023-6-5 08:43
page: true,
where:{
FT:'{$iftype}',
KP:'{$kp}',
},
function action_query($param){
global $site_path;
$kp="";
if(array_key_exists("KP",$param)){
$kp=$param["KP"];
}
$iftype=1;
if(array_key_exists("FT",$param)){
$iftype=$param["FT"]*1;
}
作者:
syant
时间:
2025-1-7 21:48
url: '../J.php/machinepad/wipinfo/query?searchParams='+encodeURI(JSON.stringify({ "AUFNR":"{$AUFNR}" })),
作者:
syant
时间:
2025-1-7 22:43
url: '../J.php/machinepad/wipinfo/query',
lineStyle: 'height: auto;', // 定义表格的多行样式
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2