Class sap.ui.table.ColumnModule: sap/ui/table/Column
The column allows you to define column specific properties that will be applied when rendering the table.
sClassName
and enriches it with the information contained in oClassInfo
.fnFunction
to the columnMenuOpen
event of this sap.ui.table.Column
.fnFunction
from the columnMenuOpen
event of this sap.ui.table.Column
.sap.ui.core.Control
in the aggregation multiLabels
.defaultFilterOperator
. Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- width : sap.ui.core.CSSSize
- flexible : boolean (default: true)
- resizable : boolean (default: true)
- hAlign : sap.ui.core.HorizontalAlign (default: Begin)
- sorted : boolean (default: false)
- sortOrder : sap.ui.table.SortOrder (default: Ascending)
- sortProperty : string
- filtered : boolean (default: false)
- filterProperty : string
- filterValue : string
- filterOperator : string
- defaultFilterOperator : string
- filterType : any
- grouped : boolean (default: false)
- visible : boolean (default: true)
- name : string
- showFilterMenuEntry : boolean (default: true)
- showSortMenuEntry : boolean (default: true)
- headerSpan : any (default: 1)
- autoResizable : boolean (default: false)
- Aggregations
- label : sap.ui.core.Control|string (default)
- multiLabels : sap.ui.core.Control[]
- template : sap.ui.core.Control
- menu : sap.ui.unified.Menu
- Events
- columnMenuOpen : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Element can be used as well.
{string} | sId? | ID for the new control, generated automatically if no ID is given |
{object} | mSettings? | Initial settings for the new control |
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{sap.ui.unified.Menu} | oControlEvent.getParameters.menu | Refence to the selected menu instance to be opened. |
- Since:
- 1.33.0
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.core.Element.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
multiLabels
. {sap.ui.core.Control} | oMultiLabel | the multiLabel to add; if empty, nothing is inserted |
- Since:
- 1.13.1
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
fnFunction
to the columnMenuOpen
event of this sap.ui.table.Column
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.table.Column
itself.
Fires before the column menu is opened.
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.table.Column itself |
- Since:
- 1.33.0
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
label
. {sap.ui.table.Column} | Reference to this in order to allow method chaining |
menu
. {sap.ui.table.Column} | Reference to this in order to allow method chaining |
multiLabels
. - Since:
- 1.13.1
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
template
. {sap.ui.table.Column} | Reference to this in order to allow method chaining |
fnFunction
from the columnMenuOpen
event of this sap.ui.table.Column
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
- Since:
- 1.33.0
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
columnMenuOpen
to attached listeners. Listeners may prevent the default action of this event by using the preventDefault
-method on the event object.
Expects the following event parameters:
menu
of typesap.ui.unified.Menu
Refence to the selectedmenu
instance to be opened.
{Map} | mArguments? | The arguments to pass along with the event |
- Since:
- 1.33.0
{boolean} | Whether or not to prevent the default action |
autoResizable
. Enables auto-resizing of the column on double-clicking the resizer. The width is determined on the widest currently displayed content. It does not consider rows which are currently not scrolled into view. Currently only implemented to work with the following controls: sap.m.Text, sap.m.Label, sap.m.Link, sap.m.Input, sap.ui.commons.TextView, sap.ui.commons.Label, sap.ui.commons.Link and sap.ui.commons.TextField, sap.ui.commons.Checkbox, sap.m.Checkbox
Default value is false
.
- Since:
- 1.21.1
{boolean} | Value of property autoResizable |
defaultFilterOperator
. If this property is set, the default filter operator of the column is overridden. By default Contains
is used for string and EQ
for other types. A valid sap.ui.model.FilterOperator
needs to be passed.
{string} | Value of property defaultFilterOperator |
filtered
. Indicates if the column is filtered. This property only controls if a filter indicator is displayed in the column header - it does not trigger the filter function. The column has to be filtered by calling Column.sort()
Default value is false
.
{boolean} | Value of property filtered |
filterOperator
. Filter operator to use when filtering this column.
{string} | Value of property filterOperator |
filterProperty
. Specifies the binding property on which the column shall be filtered. Since the column template may have composite bindings, it's not possible to figure out on which binding property the filter shall be applied. Therefore the binding property for filtering must be specified. For example, if the first name and last name are displayed in the same column, only one of the two can be defined as filterProperty
.
A column menu entry for filtering can only be generated if the filterProperty
is set. The default menu entry is a text input field.
{string} | Value of property filterProperty |
filterType
. Type of Filter. This is used to transform the search term to the specified type, to make sure that the right columns are displayed. This should be the same as defined in binding for this column. As an alternative you can pass a function which does the conversion. The function receives the entered filter value as parameter and returns the proper value for the filter expression. Another option is to pass the class name of the type, e.g.: sap.ui.model.type.Date
or an expression similar to the binding syntax, e.g.: "\{type: 'sap.ui.model.type.Date', formatOptions: \{UTC: true\}, constraints: {} \}"
. Here the escaping is mandatory to avoid handling by the binding parser. By default the filter type is sap.ui.model.type.String
.
- Since:
- 1.9.2
{any} | Value of property filterType |
filterValue
. Specifies the value of the filter as string (will be converted into the proper data type). It is possible to provide a filterOperator as string, as shown here:
> 50 < 100 >= 150 <= 200 = 250 != 300 something ends with something* starts with something* contains some..thing between 50..100 between
{string} | Value of property filterValue |
flexible
. If the table is wider than the sum of widths of the visible columns, the columns will be resized proportionally to their widths that were set originally. If set to false, the column will be displayed in the original width. If all columns are set to not be flexible, an extra "dummy" column will be created at the end of the table.
Default value is true
.
{boolean} | Value of property flexible |
grouped
. Indicates if the column is grouped.
Default value is false
.
{boolean} | Value of property grouped |
hAlign
. Horizontal alignment of the column content. Controls with a text align do not inherit the horizontal alignment. You have to set the text align directly on the template.
Default value is Begin
.
{sap.ui.core.HorizontalAlign} | Value of property hAlign |
headerSpan
. If this property is set, a span is applied for the header. When moving columns, all columns which are part of the header will be moved. The headerSpan
can be either an integer or an array of integers (if you use the multi header feature of the table). If you only specify an integer, this span is applied for all header rows, with multiple integers you can specify a separate span for each header row.
Default value is 1
.
{any} | Value of property headerSpan |
label
. Label of the column which is displayed in the column header. This aggregation is for the standard behavior, where you only want to display one single row header. If a string is supplied, a default label control will be created. Which control this is depends on the loaded libraries.
{sap.ui.core.Control|string} |
menu
. The menu used by the column. By default the sap.ui.table.ColumnMenu is used.
Note: Applications must not use or change the default sap.ui.table.ColumnMenu
of a column in any way or create own instances of sap.ui.table.ColumnMenu
. To add a custom menu to a column, use the aggregation menu
with a new instance of sap.ui.unified.Menu
.
{sap.ui.unified.Menu} |
multiLabels
. Labels of the column which are displayed in the column header. Define a control for each header row in the table. Use this aggregation if you want to use multiple headers per column.
- Since:
- 1.13.1
{sap.ui.core.Control[]} |
name
. The name of the column which is used in the column visibility menu item as text. If not set as a fallback the column menu tries to get the text from the nested Label.
- Since:
- 1.11.1
{string} | Value of property name |
resizable
. If set to true, the column can be resized either using the resize-handle (by mouse) or using the keyboard (SHIFT + Left/Right Arrow keys)
Default value is true
.
{boolean} | Value of property resizable |
showFilterMenuEntry
. Defines if the filter menu entry is displayed
Default value is true
.
- Since:
- 1.13.0
{boolean} | Value of property showFilterMenuEntry |
showSortMenuEntry
. Defines if the sort menu entries are displayed
Default value is true
.
- Since:
- 1.13.0
{boolean} | Value of property showSortMenuEntry |
sorted
. Indicates if the column is sorted. This property only controls if a sort indicator is displayed in the column header - it does not trigger the sort function. The column has to be sorted by calling Column.sort()
Default value is false
.
{boolean} | Value of property sorted |
sortOrder
. This property indicates the sort direction (Ascending or Descending). The corresponding icon will be rendered if the property sorted
is true
Default value is Ascending
.
{sap.ui.table.SortOrder} | Value of property sortOrder |
sortProperty
. Specifies the binding property on which the column will sort. Since the column template may have composite bindings, it's not possible to figure out on which binding property the sort shall be applied. Therefore the binding property for sorting must be specified. For example, if the first name and last name are displayed in the same column, only one of the two can be defined as sortProperty
.
A column menu entry for sorting can only be generated if the sortProperty
is set.
{string} | Value of property sortProperty |
template
. Template (cell renderer) of this column. A template is decoupled from the column, which means after changing the templates' properties or aggregations an explicit invalidation of the column or table is required. The default depends on the loaded libraries.
{sap.ui.core.Control} |
visible
. Invisible controls are not rendered.
Default value is true
.
{boolean} | Value of property visible |
width
. Width of the column. Works only with px/em/rem values. Em are handled like rem values.
{sap.ui.core.CSSSize} | Value of property width |
sap.ui.core.Control
in the aggregation multiLabels
. and returns its index if found or -1 otherwise. {sap.ui.core.Control} | oMultiLabel | The multiLabel whose index is looked for |
- Since:
- 1.13.1
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
multiLabels
. {sap.ui.core.Control} | oMultiLabel | the multiLabel to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the multiLabel should be inserted at; for a negative value of iIndex , the multiLabel is inserted at position 0; for a value greater than the current size of the aggregation, the multiLabel is inserted at the last position |
- Since:
- 1.13.1
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
multiLabels
. Additionally, it unregisters them from the hosting UIArea.
- Since:
- 1.13.1
{sap.ui.core.Control[]} | An array of the removed elements (might be empty) |
multiLabels
. {int|string|sap.ui.core.Control} | vMultiLabel | The multiLabelto remove or its index or id |
- Since:
- 1.13.1
{sap.ui.core.Control} | The removed multiLabel or null |
autoResizable
. Enables auto-resizing of the column on double-clicking the resizer. The width is determined on the widest currently displayed content. It does not consider rows which are currently not scrolled into view. Currently only implemented to work with the following controls: sap.m.Text, sap.m.Label, sap.m.Link, sap.m.Input, sap.ui.commons.TextView, sap.ui.commons.Label, sap.ui.commons.Link and sap.ui.commons.TextField, sap.ui.commons.Checkbox, sap.m.Checkbox
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bAutoResizable | New value for property autoResizable |
- Since:
- 1.21.1
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
defaultFilterOperator
. If this property is set, the default filter operator of the column is overridden. By default Contains
is used for string and EQ
for other types. A valid sap.ui.model.FilterOperator
needs to be passed.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sDefaultFilterOperator | New value for property defaultFilterOperator |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
filtered
. Indicates if the column is filtered. This property only controls if a filter indicator is displayed in the column header - it does not trigger the filter function. The column has to be filtered by calling Column.sort()
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bFiltered | New value for property filtered |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
filterOperator
. Filter operator to use when filtering this column.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sFilterOperator | New value for property filterOperator |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
filterProperty
. Specifies the binding property on which the column shall be filtered. Since the column template may have composite bindings, it's not possible to figure out on which binding property the filter shall be applied. Therefore the binding property for filtering must be specified. For example, if the first name and last name are displayed in the same column, only one of the two can be defined as filterProperty
.
A column menu entry for filtering can only be generated if the filterProperty
is set. The default menu entry is a text input field.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sFilterProperty | New value for property filterProperty |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
filterType
. Type of Filter. This is used to transform the search term to the specified type, to make sure that the right columns are displayed. This should be the same as defined in binding for this column. As an alternative you can pass a function which does the conversion. The function receives the entered filter value as parameter and returns the proper value for the filter expression. Another option is to pass the class name of the type, e.g.: sap.ui.model.type.Date
or an expression similar to the binding syntax, e.g.: "\{type: 'sap.ui.model.type.Date', formatOptions: \{UTC: true\}, constraints: {} \}"
. Here the escaping is mandatory to avoid handling by the binding parser. By default the filter type is sap.ui.model.type.String
.
When called with a value of null
or undefined
, the default value of the property will be restored.
{any} | oFilterType | New value for property filterType |
- Since:
- 1.9.2
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
filterValue
. Specifies the value of the filter as string (will be converted into the proper data type). It is possible to provide a filterOperator as string, as shown here:
> 50 < 100 >= 150 <= 200 = 250 != 300 something ends with something* starts with something* contains some..thing between 50..100 between
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sFilterValue | New value for property filterValue |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
flexible
. If the table is wider than the sum of widths of the visible columns, the columns will be resized proportionally to their widths that were set originally. If set to false, the column will be displayed in the original width. If all columns are set to not be flexible, an extra "dummy" column will be created at the end of the table.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bFlexible | New value for property flexible |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
grouped
. Indicates if the column is grouped.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bGrouped | New value for property grouped |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
hAlign
. Horizontal alignment of the column content. Controls with a text align do not inherit the horizontal alignment. You have to set the text align directly on the template.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Begin
.
{sap.ui.core.HorizontalAlign} | sHAlign | New value for property hAlign |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
headerSpan
. If this property is set, a span is applied for the header. When moving columns, all columns which are part of the header will be moved. The headerSpan
can be either an integer or an array of integers (if you use the multi header feature of the table). If you only specify an integer, this span is applied for all header rows, with multiple integers you can specify a separate span for each header row.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is 1
.
{any} | oHeaderSpan | New value for property headerSpan |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
label
. {sap.ui.core.Control|string} | vLabel | The label to set |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
menu
. {sap.ui.unified.Menu} | oMenu | The menu to set |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
name
. The name of the column which is used in the column visibility menu item as text. If not set as a fallback the column menu tries to get the text from the nested Label.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sName | New value for property name |
- Since:
- 1.11.1
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
resizable
. If set to true, the column can be resized either using the resize-handle (by mouse) or using the keyboard (SHIFT + Left/Right Arrow keys)
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bResizable | New value for property resizable |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
showFilterMenuEntry
. Defines if the filter menu entry is displayed
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowFilterMenuEntry | New value for property showFilterMenuEntry |
- Since:
- 1.13.0
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
showSortMenuEntry
. Defines if the sort menu entries are displayed
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bShowSortMenuEntry | New value for property showSortMenuEntry |
- Since:
- 1.13.0
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
sorted
. Indicates if the column is sorted. This property only controls if a sort indicator is displayed in the column header - it does not trigger the sort function. The column has to be sorted by calling Column.sort()
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bSorted | New value for property sorted |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
sortOrder
. This property indicates the sort direction (Ascending or Descending). The corresponding icon will be rendered if the property sorted
is true
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Ascending
.
{sap.ui.table.SortOrder} | sSortOrder | New value for property sortOrder |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
sortProperty
. Specifies the binding property on which the column will sort. Since the column template may have composite bindings, it's not possible to figure out on which binding property the sort shall be applied. Therefore the binding property for sorting must be specified. For example, if the first name and last name are displayed in the same column, only one of the two can be defined as sortProperty
.
A column menu entry for sorting can only be generated if the sortProperty
is set.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sSortProperty | New value for property sortProperty |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
template
. {sap.ui.core.Control} | oTemplate | The template to set |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
visible
. Invisible controls are not rendered.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bVisible | New value for property visible |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
width
. Width of the column. Works only with px/em/rem values. Em are handled like rem values.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.CSSSize} | sWidth | New value for property width |
{sap.ui.table.Column} | Reference to this in order to allow method chaining |
{boolean} | true, if the column should be rendered |
{boolean} | bDescending | sort order of the column (if undefined the default will be ascending) |
- Deprecated:
- Since version 1.5.1. Please use the function "sap.ui.Table.prototype.sort".
{sap.ui.table.Column} |
- Deprecated:
- Since version 1.5.1. Please use the function "sap.ui.Table.prototype.sort".
{sap.ui.table.Column} |