Skip to content

Commit

Permalink
Fix datatable scroll height when using filter or pagination (#3377)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmzdlv authored and mistercrunch committed Aug 30, 2017
1 parent c3ab796 commit 42dd64e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion superset/assets/javascripts/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ export function toggleCheckbox(apiUrlPrefix, selector) {
*/
export const fixDataTableBodyHeight = function ($tableDom, height) {
const headHeight = $tableDom.find('.dataTables_scrollHead').height();
$tableDom.find('.dataTables_scrollBody').css('max-height', height - headHeight);
const filterHeight = $tableDom.find('.dataTables_filter').height() || 0;
const pageLengthHeight = $tableDom.find('.dataTables_length').height() || 0;
const paginationHeight = $tableDom.find('.dataTables_paginate').height() || 0;
const controlsHeight = (pageLengthHeight > filterHeight) ? pageLengthHeight : filterHeight;
$tableDom.find('.dataTables_scrollBody').css('max-height', height - headHeight - controlsHeight - paginationHeight);
};

export function d3format(format, number) {
Expand Down

0 comments on commit 42dd64e

Please sign in to comment.