Skip to content

Commit

Permalink
add serverSide option to test table
Browse files Browse the repository at this point in the history
  • Loading branch information
blerrgh committed Jan 10, 2023
1 parent 8fa768a commit 8032b2f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@
const data = readable(createSamples(2, 2));
let serverSide = false;
const table = createTable(data, {
subRows: addSubRows({
children: 'children',
}),
filter: addColumnFilters(),
filter: addColumnFilters({
serverSide: serverSide,
}),
tableFilter: addTableFilter({
includeHiddenColumns: true,
serverSide: serverSide,
}),
group: addGroupBy({
initialGroupByIds: [],
}),
sort: addSortBy({
toggleOrder: ['asc', 'desc'],
serverSide: serverSide,
}),
expand: addExpandedRows({
initialExpandedIds: { 1: true },
Expand All @@ -57,6 +63,7 @@
hideColumns: addHiddenColumns(),
page: addPagination({
initialPageSize: 20,
serverSide: serverSide,
}),
resize: addResizedColumns(),
export: addDataExport(),
Expand Down Expand Up @@ -258,7 +265,8 @@
const { filterValues } = pluginStates.filter;
const { filterValue } = pluginStates.tableFilter;
const { selectedDataIds } = pluginStates.select;
const { pageIndex, pageCount, pageSize, hasPreviousPage, hasNextPage } = pluginStates.page;
const { pageIndex, pageCount, pageSize, hasPreviousPage, hasNextPage, serverItemCount } =
pluginStates.page;
const { expandedIds } = pluginStates.expand;
const { columnIdOrder } = pluginStates.orderColumns;
// $: $columnIdOrder = ['expanded', ...$groupByIds];
Expand All @@ -268,6 +276,8 @@
const { exportedData } = pluginStates.export;
const { exportedData: exportedJson } = pluginStates.exportJson;
const { exportedData: exportedCsv } = pluginStates.exportCsv;
$serverItemCount = 6;
</script>

<h1>svelte-headless-table</h1>
Expand Down Expand Up @@ -373,7 +383,8 @@
},
null,
2
)}</pre>
)}
serverSide: {serverSide}</pre>

<style>
* {
Expand Down

0 comments on commit 8032b2f

Please sign in to comment.