From 04933489ae313f45be43e1ed42d50290a08f8454 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 15 Aug 2022 06:22:22 -0700 Subject: [PATCH] docs(data-table): add example "Batch selection with controlled toolbar" --- docs/src/pages/components/DataTable.svx | 10 +++ ...ableBatchSelectionToolbarControlled.svelte | 63 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbarControlled.svelte diff --git a/docs/src/pages/components/DataTable.svx b/docs/src/pages/components/DataTable.svx index 784002f5..059c7e2d 100644 --- a/docs/src/pages/components/DataTable.svx +++ b/docs/src/pages/components/DataTable.svx @@ -1115,6 +1115,16 @@ Use the `selectedRowIds` prop to specify which rows should be selected. +### Batch selection with controlled toolbar + +By default, `ToolbarBatchActions` is activated if one or more rows is selected. Clicking "Cancel" will deactivate it. + +Use the `active` prop to control the toolbar. Note that it will still activate if one or more rows are selected. + +You can also prevent the default "Cancel" behavior in the dispatched `on:cancel` event. + + + ### Selectable (radio) diff --git a/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbarControlled.svelte b/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbarControlled.svelte new file mode 100644 index 00000000..08e5981e --- /dev/null +++ b/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbarControlled.svelte @@ -0,0 +1,63 @@ + + + + + + + + + + + +