fix: Render blank state when rows is 0

This commit is contained in:
Faris Ansari 2019-09-17 18:59:14 +05:30
parent a47e1f07eb
commit ad0e0b592a
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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;