vincjo / datatables

A toolkit for creating datatable components with Svelte
https://vincjo.fr/datatables
MIT License
372 stars 15 forks source link

is it possible to detach search and pagination #5

Closed michapixel closed 1 year ago

michapixel commented 1 year ago

the predecessor could do that ...

vincjo commented 1 year ago

thanks for asking

The approach is a little different, here the components are provided as examples with minimal configuration.

the goal is to easily adapt to as many contexts as possible. However it requires a little more work to start, it won't suit everyone.

To summarize, you create your own datatable component

<script lang="ts">
    import { DataHandler, Th, ThFilter, RowsPerPage, RowCount } from '@vincjo/datatables'

    const handler = new DataHandler(myData, { rowsPerPage: 10 })
    const rows = handler.getRows()
</script>

<header>
    <RowsPerPage {handler}/>
</header>

<table>
    <!-- stuff -->
</table>

<footer>
    <RowCount {handler}/>
</footer>
michapixel commented 1 year ago

Ah, i should have looked at the src files first, before asking :)

was just looking at the docs and somehow couldn't figure it out ...

vincjo commented 1 year ago

I was wrong, it turns out to be very useful to make these components optional. Just updated https://vincjo.fr/datatables/examples/blocks