Skip to content

Commit

Permalink
fix: Render blank state when rows is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Sep 17, 2019
1 parent a47e1f0 commit ad0e0b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ export default class Style {
setBodyStyle() {
const bodyWidth = $.style(this.datatableWrapper, 'width');
const firstRow = $('.dt-row', this.bodyScrollable);
if (!firstRow) return;
const rowWidth = $.style(firstRow, 'width');

let width = bodyWidth > rowWidth ? rowWidth : bodyWidth;
Expand Down

0 comments on commit ad0e0b5

Please sign in to comment.