I have a table with multiple select but it selects by default the index 0. How do I set up a "select all" default?
I have a table with multiple select but it selects by default the index 0. How do I set up a "select all" default?
You can pass an array of indexes into the default indexes value. All you need to do is generate an array of the indexes in the table data.
One potential way to do this would be as follows: {{ tableLocations.data.map((r, i) => i) }}
This just generates an array using the index of each element in tableLocations.data
. This looks like [0, 1, 2, 3 ...]
with the correct number of indexes.
Hopefully this helps!
Thanks James! Works like a charm.