You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An option must be added to the List action to allow configuring a batch selection system.
I see it like this:
An option batchActions in the List actions options
This option contains at least these properties:
enabled: boolean
actions: Array<{label: string, name: string}>, to determine all possible batch actions
In CrudList.svelte:
If operation.options.batchActions.enabled, inject actions in the data table like this: <DataTable /* ... */ batchActions={operation.options.batchActions.actions} /* ... */ >
In DataTable.svelte:
Create a new export let batchActions = Array<{label: string, name: string}> = []; prop
Inject in Carbon's DataTable the batchSelection={batchActions.length > 0} attribute
The toolbar must be connected to whether items were selected
A list of action buttons must be displayed depending on the batchActions var / dashboard property, so that when you click on them, the link is called.
When the link is called, dispatch a new event named batchActionCall for which event data will directly be the rows that are selected.
Then after that, in CrudList.svelte:
You add an on:batchActionCall={onBatchActionCall} attribute to your DataTable instantiation, and call your state processor, for which the data being the list of objects you just called. This will allow you to configure API calls for you batch actions on your state processor.
I'm still not 100% sure about the {label: string, name: string} type for the actions. Maybe we should create a plain NamedAction extends DefaultAction class with a constructor like constructor(label: string, name: string, icon?: ActionIcon, options?: ActionOptions), in order to have a type like actions: Array<NamedAction> in List's options , so that the name property will be used to properly name your StateProcessor's call in CrudList.svelte.
Hello,
I need to add batchSelection option in the datable to have checkboxes on rows and headers.
I made you a pull request.
Is it the right way to do it ?
Thank you
The text was updated successfully, but these errors were encountered: