Fixed a few bugs and issues with the data table.

This commit is contained in:
2025-06-21 20:37:59 -07:00
parent a356467823
commit 6503247852

View File

@ -260,7 +260,7 @@ class DataTable extends IgniteElement {
onChange: (oldValue, newValue) => { onChange: (oldValue, newValue) => {
//If the currentPage is greater than the new page count, set it to the last page. //If the currentPage is greater than the new page count, set it to the last page.
if (this.currentPage > newValue - 1) { if (this.currentPage > newValue - 1) {
this.currentPage = newValue - 1; this.currentPage = Math.max(0, newValue - 1);
} }
} }
}), }),
@ -305,7 +305,7 @@ class DataTable extends IgniteElement {
), ),
//Row count //Row count
new span().show(this.showRowCount).class(this.rowCountClass).innerHTML(this.filtered, filtered => filtered.length == 0 ? "No rows" : `${filtered.length} ${(filtered.length < 2 ? "row" : "rows")}`), new span().show(this.showRowCount).class(this.rowCountClass).innerHTML(this.filtered, filtered => (!filtered || filtered.length == 0) ? "No rows" : `${filtered.length} ${(filtered.length < 2 ? "row" : "rows")}`),
//Refresh button //Refresh button
new button().show(this.showRefreshButton).class(this.refreshButtonClass).child(new i().class("fa-solid fa-arrows-rotate")).onClick(async () => { new button().show(this.showRefreshButton).class(this.refreshButtonClass).child(new i().class("fa-solid fa-arrows-rotate")).onClick(async () => {