Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions src/body-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export default class BodyRenderer {
this.visibleRows = rows;
this.visibleRowIndices = rows.map(row => row.meta.rowIndex);

if (rows.length === 0) {
this.bodyScrollable.innerHTML = this.getNoDataHTML();
return;
}

const rowViewOrder = this.datamanager.rowViewOrder.map(index => {
if (this.visibleRowIndices.includes(index)) {
return index;
Expand Down
5 changes: 3 additions & 2 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ export default class Style {
if (this.options.layout !== 'fluid') return;

const wrapperWidth = $.style(this.instance.datatableWrapper, 'width');
const firstRowWidth = $.style($('.dt-row', this.bodyScrollable), 'width');
const firstRow = $('.dt-row', this.bodyScrollable);
const firstRowWidth = firstRow ? $.style(firstRow, 'width') : wrapperWidth;
const resizableColumns = this.datamanager.getColumns().filter(col => col.resizable);
const deltaWidth = (wrapperWidth - firstRowWidth) / resizableColumns.length;

Expand Down Expand Up @@ -297,7 +298,7 @@ export default class Style {
setBodyStyle() {
const bodyWidth = $.style(this.datatableWrapper, 'width');
const firstRow = $('.dt-row', this.bodyScrollable);
const rowWidth = $.style(firstRow, 'width');
const rowWidth = firstRow ? $.style(firstRow, 'width') : bodyWidth;

let width = bodyWidth > rowWidth ? rowWidth : bodyWidth;
$.style(this.bodyScrollable, {
Expand Down