Skip to content

Commit 2ee673a

Browse files
committed
rows getter should react to originalData
1 parent 167367d commit 2ee673a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/sweet-books-obey.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@careswitch/svelte-data-table': patch
3+
---
4+
5+
rows getter should react to `originalData`

src/lib/DataTable.svelte.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ export class DataTable<T> {
154154
* @param {T[]} rows - The array of rows to reset the base data to.
155155
*/
156156
set baseRows(rows: T[]) {
157-
this.#originalData = [...rows];
158157
this.#currentPage = 1;
159158
this.#isFilterDirty = true;
160-
this.#filterState = this.#filterState;
159+
this.#originalData = [...rows];
161160
}
162161

163162
/**
164163
* The current page of rows based on applied filters and sorting.
165164
* @returns {T[]} An array of rows for the current page.
166165
*/
167166
get rows() {
168-
// React to changes in filter state and sort state
167+
// React to changes in original data, filter state, and sort state
168+
this.#originalData;
169169
this.#filterState;
170170
this.#sortState;
171171
this.#globalFilterRegex;

0 commit comments

Comments
 (0)