Closed brucegl closed 5 months ago
I think I've figured out what the issue is. If we exclude the filter for the id (as shown in the tutorial code - first example above), then when the column is hidden, there is no longer any data to filter on, hence all the rows are removed from the table!
To overcome this, add the "includeHiddenColumns" option to the table filter as below:
const table = createTable(readable(data), {
page: addPagination(),
sort: addSortBy({ disableMultiSort: true }),
filter: addTableFilter({
includeHiddenColumns: true,
fn: ({ filterValue, value }) => value.includes(filterValue)
}),
hide: addHiddenColumns(),
select: addSelectedRows()
});
Could someone add this to the tutorial code please (and make the adjustments to the preview/code section also). Thanks
Please provide a reproduction.
This issue was closed because it was open for 7 days without a reproduction.
Describe the bug
Hi,
I followed the guide in the Data Table section and when I hide the email column then all the rows are removed and the row selection checkbox is checked.
If I then remove the following code from the id table column plugin section:
which is as you've done in the Data Table preview/code section, then I can hide the email column ok, HOWEVER, this then means that the id values are included in the filter email searches (you can see this by typing m5 in the filter email box in the Data Table preview section).
Reproduction
data-table.svelte
and then with the id filter not excluded...
Logs
No response
System Info
Severity
annoyance