Fix DataTables horizontal scrolling (scrollX) in sidebar (flex row)

- remove Bootstrap "table" class, "width: 100%" prevents scrolling,
  not needed anyway (?), seems to have no effects otherwise
- override margin auto with 0 to avoid table taking more space at
  margins than needed and getting misaligned (centered and header left)
  see also https://github.com/DataTables/DataTables/issues/539
- refactoring: use classes instead of ids
This commit is contained in:
Norbert Renner 2018-03-09 10:46:41 +01:00
parent 6c8e4fddca
commit 24d8ebebf3
2 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,7 @@ body, #content {
.flexcolumn,
.leaflet-sidebar-pane.active,
#datatable_wrapper,
.dataTables_wrapper,
.dataTables_scroll,
.dataTables_scrollBody {
display: -webkit-box;
@ -43,10 +43,10 @@ body, #content {
}
/* 'auto' (1 1 auto) instead of '1' (1 1 0) needed for DataTables tab in Firefox */
#datatable_wrapper,
.dataTables_wrapper,
.dataTables_scroll,
.dataTables_scrollBody,
#datatable {
table.dataTable {
-webkit-box-flex: auto;
-moz-box-flex: auto;
-webkit-flex: auto;
@ -225,6 +225,11 @@ https://css-tricks.com/svg-line-animation-works/
* DataTables
*/
table.dataTable {
/* avoid getting centered and header misaligned with flex row (sidebar) */
margin: 0;
}
table.dataTable.mini thead th,
table.dataTable.mini thead td {
padding: 3px 13px 3px 2px;

View file

@ -206,7 +206,7 @@
<div class="leaflet-sidebar-pane" id="tab_data">
<h1 class="leaflet-sidebar-header">Data<span class="leaflet-sidebar-close"><i class="fa fa-caret-right"></i></span></h1>
<table id="datatable" class="table mini cell-border hover stripe"></table>
<table id="datatable" class="mini cell-border hover stripe"></table>
</div>
<div class="leaflet-sidebar-pane" id="tab_itinerary">