OnOffColumn component
The OnOffColumn component is a decorator for MultiselectColumn. It displays toggle switch elements instead of checkboxes.
Options
Option
Description
Type
Default Value
componentThe path to the component's
.js file in terms of RequireJS.String
Magento_Ui/js/grid/columns/onoffbodyTmplPath to the template that is used to render a column's field in the table's body.
String
ui/grid/cells/onofffieldClassAdditional CSS classes added to the column's field elements.
{[name: string]: boolean}{'admin__scope-old': true, 'data-grid-onoff-cell': true, 'data-grid-checkbox-cell': false}headerTmplPath to the
.html template for the column's header.String
ui/grid/columns/onoffSource files
Extends MultiselectColumn:
- app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js
- app/code/Magento/Ui/view/base/web/templates/grid/cells/onoff.html
- app/code/Magento/Ui/view/base/web/templates/grid/columns/onoff.html
Examples
Integration
This example integrates the OnOffColumn component with the Listing component:
<listing>
...
<columns>
...
<column name="on_off_column_example_1" component="Magento_Ui/js/grid/columns/onoff">
<settings>
<dataType>select</dataType>
</settings>
</column>
</columns>
</listing>
Result