Column visibility
const view = table.createView([
{ index: 0, name: 'ID', isVisible: false },
{ index: 1, name: 'First name' },
{ index: 2, name: 'Last name' },
{ index: 3, name: 'Email' },
])
{#each view.columns as column}
<button type="button"
class:active={column.isVisible}
onclick={() => column.toggle()}
>
{column.name}
</button>
{/each}
Toggle visibility
ID | First Name | Last Name | Email |
---|---|---|---|
1 | Sallyann | Curnnokk | scurnnokk0@fc2.com |
2 | Alix | Lavigne | alavigne1@telegraph.co.uk |
3 | Belia | Gorman | bgorman2@odnoklassniki.ru |
4 | Wes | Gullyes | wgullyes3@netscape.com |
5 | Karlyn | Halt | khalt4@upenn.edu |
6 | Meggi | Younge | myounge5@blogs.com |
7 | Douglass | Kynd | dkynd6@godaddy.com |
8 | Jesse | Pattemore | jpattemore7@mozilla.org |
9 | Etti | Gowrich | egowrich8@google.ca |
10 | Meaghan | Petrina | mpetrina9@merriam-webster.com |