layui實現table加載

js實現:

layui.use(['table','form'], function() {
$ = layui.jquery;
table = layui.table;
tableIns = initTable();
});
//加載列表
function initTable(){
// 執行渲染
tableIns = table.render({
id: 'idTest',
elem : '#deviceTable', // 指定原始表格元素選擇器(推薦id選擇器)
size: 'lg',
height : 'full-20', // 容器高度
url : '/csCloud-admin/deviceController/getDeviceList.do',
where: {
'orgId':$("#orgId").val(),
'coldNum':$("#coldNum").val(),
'devType':$("#devType").val(),
'isUsed':$("#isUsedId").val()
},
method : 'post',
cols : [ [ // 標題欄
{
field : 'rownum',
title : '序號',
width : 100,
sort : true
}, {
field : 'devNum',
title : '設備編號',
width : 200
}, {
field : 'devAlias',
title : '設備別名',
width : 100
}, {
field : 'devTypeVal',
title : '設備類型',
width : 100
}, {
field : 'devModel',
title : '設備型號',
width : 100
}, {
field : 'stateVal',
title : '設備狀態',
width : 100
}, {
field : 'coldNum',
title : '冷庫編號',
width : 100
}, {
field : 'orgName',
title : '所屬機構',
width : 300
}, {
field : 'isUsedValue',
title : '狀態',
width : 100
}, {
fixed : 'right',
width : 300,
align:'center',
toolbar : '#barDemo'
}
] ], // 設置表頭
page : true,
limits : [ 10,30, 60, 90, 150, 300 ],
limit : 10
});
return tableIns;
}
jsp實現:

<div class="layui-fluid">
		<div class="layui-row">
			<div class="layui-col-lg12">
				<table id="deviceTable"></table>
			</div>
		</div>
	</div>



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章