Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

fix(legacy-table): container height on tall headers #398

Merged
merged 2 commits into from Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -185,9 +185,13 @@ export default function ReactDataTable(props: DataTableProps) {
const dataTable = $root.find('table').DataTable(options);

// adjust table height
const scrollHeadHeight = 34;
const paginationHeight = hasPagination ? 35 : 0;
const searchBarHeight = hasPagination || includeSearch ? 35 : 0;
const scrollHeadHeight = $root.find('.dataTables_scrollHead').height() || 0;
const paginationHeight = $root.find('.dataTables_paginate').height() || 0;
const searchBarHeight =
$root
.find('.dataTables_length,.dataTables_filter')
.closest('.row')
.height() || 0;
const scrollBodyHeight = viewportHeight - scrollHeadHeight - paginationHeight - searchBarHeight;
$root.find('.dataTables_scrollBody').css('max-height', scrollBodyHeight);

Expand Down Expand Up @@ -238,7 +242,7 @@ export default function ReactDataTable(props: DataTableProps) {
style={{
backgroundImage: keyIsMetric ? cellBar(key, val as number) : undefined,
}}
title={keyIsMetric || percentMetricsSet.has(key) ? (val as string) : ''}
title={keyIsMetric || percentMetricsSet.has(key) ? String(val) : ''}
>
{isHtml ? null : text}
</td>
Expand Down
Expand Up @@ -168,7 +168,7 @@
"gender": "gender",
"name": "name",
"num": "num",
"state": "state",
"state": "state (this is a very very very long column)",
"sum_boys": "sum_boys",
"sum_girls": "sum_girls"
},
Expand Down