Skip to content

Commit

Permalink
Merge pull request #11 from jackkjhsu/master
Browse files Browse the repository at this point in the history
Some minor fixes
  • Loading branch information
lekoala authored Sep 28, 2023
2 parents 05f2037 + 48ab225 commit d986e7e
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 18 deletions.
12 changes: 11 additions & 1 deletion dist/data-grid.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/data-grid.css.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/data-grid.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/data-grid.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/data-grid.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/data-grid.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/data-grid.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/data-grid.min.js.map

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion scss/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ data-grid {
}
}

tr {
&.dg-fake-row {
height: 4rem;
border: none;
}
}

&.dg-network-error {
table {
color: #842029;
Expand All @@ -392,17 +399,28 @@ data-grid {
}

tbody {
height: 8rem;
height: auto;

&:before {
font-size: 2rem;
top: auto;
transform: translate(-50%);
}

tr:not(.dg-fake-row) {
display: none;
}
}
}

&:not(.dg-network-error) {
tbody {
&:before {
top: auto;
transform: translate(-50%, 30%);
}
}
}
}

// Zebra rows
Expand Down
8 changes: 6 additions & 2 deletions src/data-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@ class DataGrid extends BaseElement {
* @returns {Promise}
*/
loadData() {
const flagEmpty = () => !this.data.length && this.classList.add("dg-empty");
const flagEmpty = () => !this.data.length && this.classList.add("dg-empty"),
tbody = this.querySelector("tbody");
// We already have some data
if (this.meta || this.originalData || this.classList.contains("dg-initialized")) {
// We don't use server side data
Expand Down Expand Up @@ -983,13 +984,16 @@ class DataGrid extends BaseElement {
.catch((err) => {
this.log(err);
if (err.message) {
this.querySelector("tbody").setAttribute("data-empty", err.message.replace(/^\s+|\r\n|\n|\r$/g, ""));
tbody.setAttribute("data-empty", err.message.replace(/^\s+|\r\n|\n|\r$/g, ""));
}
this.classList.add("dg-empty", "dg-network-error");
})
// @ts-ignore
.finally(() => {
flagEmpty();
if (!this.classList.contains("dg-network-error") && tbody.getAttribute("data-empty") != this.labels.noData) {
tbody.setAttribute("data-empty", this.labels.noData);
}
this.classList.remove("dg-loading");
this.loading = false;
})
Expand Down

0 comments on commit d986e7e

Please sign in to comment.