eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiBasicTable] Option to make selected table items controlled from a parent component

Open xcrzx opened this issue 3 years ago • 0 comments

Related issues: https://github.com/elastic/kibana/issues/136616

Summary

Currently, EuiBasicTable doesn't support the table selection to be controlled from a parent component. That means if there's a global state that keeps track of selected table rows, all changes to that global state and the local EUI table state should be synchronized manually using the imperative setSelection() API. That makes state synchronization logic pretty complicated and error-prone. For example, here's how the selection state gets synchronized in Security Solution.

It would be nice to have an option to fully control selected table rows from the outside in a declarative way. Something like:

<EuiBasicTable
  selection={{
    selected: selectedItems
  }}
/>

xcrzx avatar Aug 26 '22 13:08 xcrzx