diff --git a/common/images/ui_comps/ui-column-result.png b/common/images/ui_comps/ui-column-result.png new file mode 100644 index 00000000000..23f2577e500 Binary files /dev/null and b/common/images/ui_comps/ui-column-result.png differ diff --git a/guides/v2.2/ui_comp_guide/components/ui-column.md b/guides/v2.2/ui_comp_guide/components/ui-column.md index 65bf7e20b70..2ede03ca9ce 100644 --- a/guides/v2.2/ui_comp_guide/components/ui-column.md +++ b/guides/v2.2/ui_comp_guide/components/ui-column.md @@ -7,136 +7,63 @@ The Column component implements a basic column in [Listing]({{ page.baseurl }}/u ## Configuration options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionDescriptionTypeDefault
componentThe path to the component's .js file in terms of RequireJS.StringMagento_Ui/js/grid/columns/column
bodyTmplPath to the template used for rendering column's fields in the table's body.Stringui/grid/cells/text
controlVisibilityWhether a user can control column's visibility handled by the ColumnsControls component.Booleantrue
disableActionDisables the action set in the templates.fieldAction property.Booleanfalse
draggableDefines if a user can change column's position in the table by grabbing column's header and dragging it across the table.Booleantrue
editor - String | Object -
fieldClassAdditional CSS classes added to the column's field elements.{[name: String]: Boolean}''
filterReference to one of the available filter types defined in the Filters component. If the value represents an object containing the filterType field, this object is considered as an extension of the referenced filter element. If there's no such field in the value object, it is considered as a definition of a custom filter element.String | Object -
headerTmplPath to the .html template for the column's header.Stringui/grid/columns/text
labelThe column label displayed in the header.String''
sortableWhether column's fields can be used to sort records in a table.Booleantrue
sortingColumn's sorting order. Can be ascending (asc), descending (desc) or none (false). Setting sorting to false does not disable sorting, which is defined by the sortable option.asc | desc | Booleanfalse
statefullDefined in the parent uiElement class. - {visible: true, sorting: true}
templates.fieldActionThe action performed on the column's field click.ColumnAction-
visibleInitial component's visibility. When set to false, the display: none CSS style is added to the component's DOM block.Booleantrue
+| Option | Description | Type | Default | +| --- | --- | --- | --- | +| `component` | The path to the component's `.js` file in terms of RequireJS. | String | `Magento_Ui/js/grid/columns/column` | +| `bodyTmpl` | Path to the template used for rendering column's fields in the table's body. | String | `ui/grid/cells/text` | +| `controlVisibility` | Whether a user can control column's visibility handled by the [ColumnsControls component]({{ page.baseurl }}/ui_comp_guide/components/ui-columnscontrols.html). | Boolean | `true` | +| `disableAction` | Disables the action set in the `templates.fieldAction` property. | Boolean | `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 | `true` | +| `editor` | | String \| Object | | +| `fieldClass` | Additional CSS classes added to the column's field elements. | {[name: String]: Boolean} | `''` | +| `filter` | Reference to one of the available filter types defined in the [Filters component]({{ page.baseurl }}/ui_comp_guide/components/ui-filters.html). If the value represents an object containing the `filterType` field, this object is considered as an extension of the referenced filter element. If there's no such field in the value object, it is considered as a definition of a custom filter element. | String \| Object | `-` | +| `headerTmpl` | Path to the `.html` template for the column's header. | String | `ui/grid/columns/text` | +| `label` | The column label displayed in the header. | String | `''` | +| `sortable` | Whether column's fields can be used to sort records in a table. | Boolean | `true` | +| `sorting` | Column's sorting order. Can be ascending (`asc`), descending (`desc`) or none (`false`). Setting `sorting` to `false` does not disable sorting, which is defined by the `sortable` option. | String \| Boolean | `false` | +| `statefull` | Defined in the parent [uiElement class]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_uielement_concept.html). | Object | `{visible: true, sorting: true}` | +| `templates.fieldAction` | The action performed on the column's field click. | [ColumnAction](#column_action) | `-` | +| `visible` | Initial component's visibility. When set to `false`, the `display: none` CSS style is added to the component's DOM block. | Boolean | `true` | ### ColumnAction interface {#column_action} - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionDescriptionTypeRequired
paramsA list of arguments that will be passed to the method.ArrayOptional
providerReference to component.StringRequired
targetName of the component's method to be invoked.StringRequired
+| Option | Description | Type | Required | +| --- | --- | --- | --- | +| `params` | A list of arguments that will be passed to the method. | Array | Optional | +| `provider` | Reference to component. | String | Required | +| `target` | Name of the component's method to be invoked. | String | Required | ## Source files Extends [`UiElement`]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_uielement_concept.html): - [`Magento/Ui/view/base/web/js/grid/columns/column.js`]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Ui/view/base/web/js/grid/columns/column.js) +- [`Magento/Ui/view/base/web/templates/grid/cells/text.html`]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Ui/view/base/web/templates/grid/cells/text.html) + +## Examples + +### Integrate Column component with Listing component + +This is an example of how the Column component integrates with the [Listing]({{ page.baseurl }}/ui_comp_guide/components/ui-listing-grid.html) component: + +```xml ++ ... + + ... + + + text + text + + + + ... + + ... + +``` + +#### Result + +![Column Component Example]({{ site.baseurl }}/common/images/ui_comps/ui-column-result.png)