Appearance
useCheckboxes
This composable supports selecting checkboxes in tables. It operates on an object that contains information for the selector selecting actions to be performed on selected checkboxes:
countAll
: counter of all recordscountPage
: record counter per pagemarkAll
: whether all have markedtype
: chosen - selected, all - allitems
: array of ids of selected items, for type all it is always emptytypes
: array of types/actions - can be changed in the view
Metody
The following methods(functions) are available:
toggle(id: number)
- checks/unchecks the checkbox, adding it to the selected listtoggleAll(arr: Array<Item>)
- selects all checkboxes on the pagetoggleType(arr: Array<Item>, type: string)
- selects all checkboxes of the selected type on the pageinList(id: number)
- checks whether the record with a specific id is on the selected listsetLimit(limit: number)
- sets the checkbox counter per pagetotalChecked()
- returns a counter of all available recordssetTotal(total: number)
- sets the counter of all available recordsisAll()
- checks whether the selection type covers all records on the pageisIndeterminate()
- checks if any records are selectedgetType()
- returns the type of selected recordssetType(type: string)
- sets the type of selected recordsgetMarkAll()
- returns information about whether the selection includes all available recordssetMarkAll(markAll: boolean)
- sets information about whether the selection includes all available recordsgetTypes()
- returns a list of available typessetTypes(types: Array<string>)
- adds an array of available typesgetForAction()
- returns an object with data needed to perform the operation (e.g. change/delete)