dasDaniel / svelte-table

A svelte table implementation that allows sorting and filtering
https://dasdaniel.github.io/svelte-table/
MIT License
535 stars 40 forks source link

Getting the count of filtered rows. #111

Closed ctiospl closed 2 years ago

ctiospl commented 2 years ago

Was wondering if it is possible to get the count of the filtered rows. Thanks

dasDaniel commented 2 years ago

There is an exposed internal un-document variable called c_rows that you can get the value of

<script>
  let filteredRows = [];
  //... etc
</script>

<SvelteTable columns="{columns}" rows="{rows}" bind:c_rows={filteredRows}/>
{ filteredRows.length }

This can give you the filtered columns.

Just note that due to the nature of undocumented features that rely on exposed internals, it could break in in some future release.