MultiselectColumn component
Overview
The MultiselectColumn component implements a column with check boxes for selecting records. It also provides controls for selecting multiple records.
MultiselectColumn is a child of the Listing component and is rendered in its view. Like any component, it can hold the sort order value, which influences the order of all its child elements.
MultiselectColumn JS Component Structure
The MultiselectColumn component is implemented in the class app\code\Magento\Ui\view\base\web\js\grid\columns\multiselect.js.
Templates used by this component are:
app\code\Magento\Ui\view\base\web\templates\grid\cells\multiselect.html
- The template defines each field in the grid. It provides the Multiselect component with the check box interface for selecting item(s) in the grid and performing actions over them.app\code\Magento\Ui\view\base\web\templates\grid\columns\multiselect.html
- The template defines the grid header with drop-down lists and the Select All, Deselect All, and other options.
MultiselectColumn configuration
Extends all Column configuration.
MultiselectColumn-specific configuration:
Option | Description | Type | Default Value |
---|---|---|---|
bodyTmpl |
Path to the template that is used to render a column's field in the table's body. | String | ui/grid/cells/multiselect |
controlVisibility |
Whether a user can control column's visibility handled by the ColumnsControls component. | String | false |
draggable |
Defines if a user can change column's position in the table by grabbing column's header and dragging it across the table. | Boolean | false |
fieldClass |
Additonal CSS classes added to the column's field elements. | { [name: string]: boolean } |
{'data-grid-checkbox-cell': true } |
headerTmpl |
Path to the .html template for the column's header. |
String | ui/grid/columns/multiselect |
preserveSelectionsOnFilter |
Whether to preserve selected items when a new filter value is applied. | Boolean | false |
sortable |
Whether a column's fields can be used to sort records in the table. | Boolean | false |
Methods and Events
No events are generated. Any other component that can retrieve access to this component and its properties can get data and track its changes using subscription.
How to configure a MultiselectColumn сomponent already used in code
Sample of code where component configurations are performed:
Current implementation:
Example configuration modifications:
- Redefining the link to the template
- Redefining the name of the property which represents record identifier
- Redefining a property data source
How to add a new component
Instance Replacement: One Instance of a Component
- Redefine the link to constructor: