I am using tankstack table in my svelte project. I want to add checkbox to select the row in the table. How can i do it?
i checked react example but could not figure how to do it for svelte. Has someone tried it or has any idea how to do it?
I am using tankstack table in my svelte project. I want to add checkbox to select the row in the table. How can i do it?
i checked react example but could not figure how to do it for svelte. Has someone tried it or has any idea how to do it?
Copyright © 2021 Jogjafile Inc.
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: