本文整理自网络,侵删。
更改BootstrapTable.prototype.resetView
方法,以支持高度百分比定义,适应不同高度屏幕
BootstrapTable.prototype.resetView = function (params) { var padding = 0; if (params && params.height) { this.options.height = params.height; } this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length); if (this.options.height) { var toolbarHeight = this.$toolbar.outerHeight(true), paginationHeight = this.$pagination.outerHeight(true), height = this.options.height; //关键代码 if (this.options.height.toString().indexOf("%") != -1) { height = $(window).height() * (parseFloat(this.options.height) / 100); } height = height - toolbarHeight - paginationHeight; this.$tableContainer.css('height', height + 'px'); } if (this.options.cardView) { // remove the element css this.$el.css('margin-top', '0'); this.$tableContainer.css('padding-bottom', '0'); this.$tableFooter.hide(); return; } if (this.options.showHeader && this.options.height) { this.$tableHeader.show(); this.resetHeader(); padding += this.$header.outerHeight(); } else { this.$tableHeader.hide(); this.trigger('post-header'); } if (this.options.showFooter) { this.resetFooter(); if (this.options.height) { padding += this.$tableFooter.outerHeight() + 1; } } // Assign the correct sortable arrow this.getCaret(); this.$tableContainer.css('padding-bottom', padding + 'px'); this.trigger('reset-view'); };
更改后的bootstrap-table.js的完整代码:
相关阅读 >>
php函数之error_reporting(e_all ^ e_notice)详细说明
fateextella阿提拉阵营人物伊斯坎达尔图鉴及资料介绍
更多相关阅读请进入《帝国CMS》频道 >>