Home > front end >  How layui table module loading has local data
How layui table module loading has local data

Time:04-22

because the interface is used before, no paging parameters, the first direct access to all the data back, want to ask next after you come back to the data on the Layui Table module to how paging, look at the Table. The render () is a data parameter (direct assignment data, applies to only show a page of data, it is also very suitable for a multi-page presentation of data is known,), but no response, this how to write?
$. Ajax ({
Type: "get",
Async: true,
Url: ", "
DataType: 'json,
Data: {
"UserId" : 9,
},
Success: the function (res) {
Var obj=JSON. Parse (res);
Result=obj. Data;
The console. The log (result)
Layui. Use ([' form ', 'table'], function () {
var form=layui.form;
Var table=layui. Table;
The console. The log (result)
Table. The render ({
Elem: '# createTable',
The toolbar: "# toolbarDemo",
Data: the result,
Cols: [[
{type: "checkbox", width: 50},
{field: 'FarmerIcitemId', width: 80, the title: "ID", sort: true},
{field: 'FarmerName', width: 80, the title: 'user name'},
]],
Limits: [10, 15, 20, 25, 50, 100],
Limit: 14,
Page: {
Curr: 1
},
Skin: 'the line'

});
});
}


});
  • Related