vincjo / datatables

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

Row selection documentation is broken #111

Closed herveDarritchon closed 5 days ago

herveDarritchon commented 6 days ago

I want to look at the row selection documentation but the page is broken -> https://vincjo.fr/datatables/examples/row-selection

Can you fix it or explains how to add a row selection please ?

vincjo commented 5 days ago

Thx for notifying, just fixed the documentation page: https://vincjo.fr/datatables/examples/row-selection

Bellow is a basic setup:

// stores:
const selected = handler.getSelected()
const isAllSelected = handler.isAllSelected()
<!-- selectAll checkbox: -->
<input type="checkbox"
    on:click={() => handler.selectAll()}
    checked={$isAllSelected}
/>
<!-- rows markup -->
<tbody>
    {#each $rows as row}
        <tr class:active={$selected.includes(row)}>
            <td>
                <input type="checkbox"
                    on:click={() => handler.select(row)}
                    checked={$selected.includes(row)}
                />
            </td>
            [...]
herveDarritchon commented 5 days ago

Thanks a lot for your answer and your lib ! Nice work :)