Skip to content

Commit b861e1e

Browse files
committed
add server side option to addTableFilter
1 parent 8a64567 commit b861e1e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/lib/plugins/addTableFilter.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface TableFilterConfig {
77
fn?: TableFilterFn;
88
initialFilterValue?: string;
99
includeHiddenColumns?: boolean;
10+
serverSide?: boolean;
1011
}
1112

1213
export interface TableFilterState<Item> {
@@ -106,6 +107,7 @@ export const addTableFilter =
106107
fn = textPrefixFilter,
107108
initialFilterValue = '',
108109
includeHiddenColumns = false,
110+
serverSide = false,
109111
}: TableFilterConfig = {}): TablePlugin<
110112
Item,
111113
TableFilterState<Item>,
@@ -115,7 +117,7 @@ export const addTableFilter =
115117
({ columnOptions }) => {
116118
const filterValue = writable(initialFilterValue);
117119
const preFilteredRows = writable<BodyRow<Item>[]>([]);
118-
const filteredRows = writable<BodyRow<Item>[]>([]);
120+
//const filteredRows = writable<BodyRow<Item>[]>([]);
119121
const tableCellMatches = recordSetStore();
120122

121123
const pluginState: TableFilterState<Item> = { filterValue, preFilteredRows };
@@ -131,8 +133,12 @@ export const addTableFilter =
131133
includeHiddenColumns,
132134
});
133135
tableCellMatches.set($tableCellMatches);
134-
filteredRows.set($filteredRows);
135-
return $filteredRows;
136+
//filteredRows.set($filteredRows);
137+
if (serverSide) {
138+
return $rows;
139+
} else {
140+
return $filteredRows;
141+
}
136142
});
137143
};
138144

0 commit comments

Comments
 (0)