Next, define your column's as normal, passing in the following items we'll need in the component as well as your object type. For context, I have a custom Child type defined in my project.
Before we create our table, we need to handle ticking a checkbox by defining a state object and a function to handle updates. This is indirectly passed along to the component, through TanStack via on:change={onChange}.
I was struggling with this myself, and have come up with the following solution.
First, create a
RowCheckBox.svelte
component:Next, define your column's as normal, passing in the following items we'll need in the component as well as your object type. For context, I have a custom
Child
type defined in my project.Before we create our table, we need to handle ticking a checkbox by defining a state object and a function to handle updates. This is indirectly passed along to the component, through TanStack via
on:change={onChange}
.Finally this can all be passed into table options: