Skip to content
Discussion options

You must be logged in to vote

Try using the DataTable cellHeader slot with columnMenu: true on the header to render a MultiSelect (or Dropdown) filter directly in the column header. The cellHeader slot receives { header } and lets you customize the header content per column. Subsequently, you can filter the rows in your script based on selectedStatuses before passing to DataTable.

<script>
  import { DataTable, MultiSelect } from 'carbon-components-svelte';

  const headers = [
    { key: 'name', value: 'Name' },
    { key: 'status', value: 'Status', columnMenu: true },
  ];

  const rows = [
    { id: 1, name: 'Item 1', status: 'Active' },
    { id: 2, name: 'Item 2', status: 'Inactive' },
  ];

  let selectedStatuses =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by metonym
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants