File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @careswitch/svelte-data-table ' : patch
3
+ ---
4
+
5
+ Pagination accessors should react to filter state
Original file line number Diff line number Diff line change @@ -206,6 +206,10 @@ export class DataTable<T> {
206
206
* @returns {number } The total number of pages.
207
207
*/
208
208
get totalPages ( ) {
209
+ // React to changes in filter state
210
+ this . #filterState;
211
+ this . #globalFilterRegex;
212
+
209
213
this . #applyFilters( ) ;
210
214
return Math . max ( 1 , Math . ceil ( this . #filteredData. length / this . #pageSize) ) ;
211
215
}
@@ -230,6 +234,10 @@ export class DataTable<T> {
230
234
* @returns {boolean } True if there's a previous page available, false otherwise.
231
235
*/
232
236
get canGoBack ( ) {
237
+ // React to changes in filter state
238
+ this . #filterState;
239
+ this . #globalFilterRegex;
240
+
233
241
return this . currentPage > 1 && this . #filteredData. length > 0 ;
234
242
}
235
243
@@ -238,6 +246,10 @@ export class DataTable<T> {
238
246
* @returns {boolean } True if there's a next page available, false otherwise.
239
247
*/
240
248
get canGoForward ( ) {
249
+ // React to changes in filter state
250
+ this . #filterState;
251
+ this . #globalFilterRegex;
252
+
241
253
return this . currentPage < this . totalPages && this . #filteredData. length > 0 ;
242
254
}
243
255
You can’t perform that action at this time.
0 commit comments