html:
<table id="demo" lay-filter="test"></table> // form layui.use('table', function()
{ var table = layui.table; var cols = [], data = []; $.ajax({url:
"/index.php?c=Api&a=getProductByCategory&cid={$data[0][classid]}", async: false,
success:function(re){ data = re.data; cols = re.cols; }}); table.render({ elem:
'#demo' ,cols: [cols] ,data: data }); /* table.render({ elem: '#demo' ,cols:
[cols] ,url: '/index.php' ,method: 'get' ,where:
{c:'Api',a:'getProductByCategory',cid:'{$data[0][classid]}'} ,request: {
pageName: 'page' // Parameter name of page number , default :page ,limitName: '9999' // Parameter name of data amount per page , default :limit }
,parseData: function(res){ //res This is the original returned data return { "code": res.code, // Resolve interface state
"msg": res.msg, // Parsing prompt text "count": res.count, // Parsing data length "cols": res.cols, //cols
"data": res.data // Parse data list }; } //,page: true // Display pagination //,limits: [5, 7, 10]
//,limit: 5 // Number of default displays per page }); */ });
Technology