import { Selection } from ‘entcore-toolkit’;
const selection = new Selection(myArray);
Selection
The selection tool is a basic utility to make working with lists of selectable items easier. It works by simply passing an array to a new Selection:
The objects inside the Array should implement Selectable, which simply means they have a selected property. The selected property will be true when an user has selected the item, false otherwise.
The selection can then be used for various operations:
Description | Member |
---|---|
Get all selected items |
|
Select all items |
|
Deselect all items |
|
Number of selected items |
|
Number of items in the whole collection |
|
Select items matching predicate |
|
Remove selected items from the whole collection |
|