Bootstrop Table窗口大小改变时修改Table高度

初始化表格参数的时候我们设置高度:

tableBox.bootstrapTable('destroy').bootstrapTable({
    undefinedText: "-", //查找的字段没有发现时的显示内容
    height: $(window).height() - 100, //自定义表格的高度
    data: tableData,
    columns: CacheData.columnArr
});

但是当我们改变窗口的大小时,会出现两个竖向的滚动条,这是不正确的,解决的办法是:
给窗口添加一个resize()的监听事件

$(window).resize(function() {
    tableBox.bootstrapTable('resetView', {
        height: $(window).height() - 100
    });
});

猜你喜欢

转载自blog.csdn.net/qq_34543252/article/details/79084757