Skip to content

Commit 9c97c56

Browse files
authored
Merge pull request #212 from frappe/revert-210-no-message-ux
Revert "fix(ux): better no data experience"
2 parents 3de43c9 + 0b842ef commit 9c97c56

3 files changed

Lines changed: 4 additions & 30 deletions

File tree

src/body-renderer.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import HyperList from 'hyperlist';
2+
23
export default class BodyRenderer {
34
constructor(instance) {
45
this.instance = instance;
@@ -14,10 +15,9 @@ export default class BodyRenderer {
1415
renderRows(rows) {
1516
this.visibleRows = rows;
1617
this.visibleRowIndices = rows.map(row => row.meta.rowIndex);
17-
this.instance.noData = false;
18+
1819
if (rows.length === 0) {
1920
this.bodyScrollable.innerHTML = this.getNoDataHTML();
20-
this.instance.noData = true;
2121
this.footer.innerHTML = '';
2222
return;
2323
}
@@ -140,18 +140,7 @@ export default class BodyRenderer {
140140
}
141141

142142
getNoDataHTML() {
143-
const width = this.instance.header.scrollWidth;
144-
const height = this.bodyScrollable.clientHeight;
145-
return `
146-
<div
147-
class="dt-scrollable__no-data"
148-
style="width: ${width - 2}px; height: ${height}px"
149-
>
150-
<div class="dt-scrollable__no-data no-data-message">
151-
${this.options.noDataMessage}
152-
</div>
153-
</div>
154-
`;
143+
return `<div class="dt-scrollable__no-data">${this.options.noDataMessage}</div>`;
155144
}
156145

157146
getToastMessageHTML(message) {

src/style.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
--dt-selection-highlight-color: var(--dt-light-yellow);
1717
--dt-toast-message-border: none;
1818
--dt-header-cell-bg: var(--dt-cell-bg);
19-
--dt-no-data-message-width: 90px;
2019
}
2120

2221
.datatable {
@@ -55,15 +54,7 @@
5554
padding: var(--dt-spacer-3);
5655
border-left: 1px solid var(--dt-border-color);
5756
border-right: 1px solid var(--dt-border-color);
58-
.no-data-message{
59-
position: absolute;
60-
top: 100px;
61-
left: 50px;
62-
border: none;
63-
width: var(--dt-no-data-message-width);
64-
}
6557
}
66-
6758
}
6859

6960
.dt-row {

src/style.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default class Style {
7777
// Find corresponding footer cell
7878
const footerCell = this.footer.querySelector(`.dt-cell[data-col-index="${colIndex}"]`);
7979

80-
if (bodyCell && ~~(bodyCell.offsetLeft - scrollLeft) > colLeft) {
80+
if (~~(bodyCell.offsetLeft - scrollLeft) > colLeft) {
8181
headerCell.style.transform = `translateX(${-scrollLeft - 1}px)`;
8282
if (footerCell) {
8383
footerCell.style.transform = `translateX(${scrollLeft ? -scrollLeft - 1 : 0}px)`;
@@ -89,12 +89,6 @@ export default class Style {
8989
});
9090

9191
this._settingHeaderPosition = false;
92-
if (this.instance.noData) {
93-
$.style($('.no-data-message'), {
94-
left: `${this.instance.wrapper.clientWidth / 2 - (-scrollLeft)}px`
95-
});
96-
}
97-
this._settingHeaderPosition = false;
9892
});
9993
});
10094
}

0 commit comments

Comments
 (0)