一般在使用BootstrapTable 插件的时候,我是不固定高度的,没有height属性时候的插件一切正常,表格对齐也没有问题。但是为了将页面撑开,使数据少的时候,页面不显得空荡,所以就固定了高度:

height: $(window).height()*0.79,
  • 1

根据页面的大小进行动态变化。此时就会出现表格不对齐的现象,解决方法:

打开bootstrap-table.js 找到 BootstrapTable.prototype.resetView方法,找到如下代码:

if (this.options.showHeader && this.options.height) {
            this.$tableHeader.show();
            //注释掉下面两行 取消表头初始化解决表头和内容不对齐问题
            //this.resetHeader();
            //padding += this.$header.outerHeight();
}

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-11-06
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-02-24
  • 2022-12-23
相关资源
相似解决方案