function loadTable(tableData) {
instable = layui.table.render({
even: true,
page: true,
title: '',
elem: '#demo',
page: {
layout: ['prev', 'page', 'next', 'limit', 'count', 'skip']
, first: false
, last: false
, prev: '上一页'
, next: '下一页'
},
height: $("#id").parent().height() - 30,
cols: [[
, { field: 'id', title: 'id', hide: true, align: 'center' }
, { field: 'value', title: '值', align: 'center' }
]],
data: tableData
});
}
$(window).on('resize', function() {
updateTableHeight();
});
function checkScreenSize() {
var screenWidth = $(window).width();
var screenHeight = $(window).height();
console.log('屏幕宽度: ' + screenWidth + 'px');
console.log('屏幕高度: ' + screenHeight + 'px');
}
function updateTableHeight() {
var newHeight = $("#id").parent().height() - 30;
instable.reload({
height: newHeight
});
}