Usage
Signature:
interface CTableElement<K extends string | number,D,C extends string>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CTableElement } from "oj-c/table";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/table";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Slots
JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.
-
cellTemplate
-
The template for rendering each data cell in the table. When a column.template is specified that will take precedence over this template. The slot content must be a template element. The content of the template should not include the td element, only its contents. The template has access to the context CellTemplateContext via $current or the aliased name for $current set via data-oj-as.
Properties of $current:
Name Type Argument Description columnKeyC Column key dataD[keyof D] <optional>
Data for the cell, derived from the column.field property isTabbableboolean Whether the cell is in tabbable mode or not. itemItem.<K, D> Row item containing data and metadata -
footerTemplate
-
The template for rendering each footer cell in the table. When a column.footerTemplate is specified that will take precedence over this template. The slot content must be a template element. The content of the template should not include the td element, only its contents. The template has access to the context FooterTemplateContext via $current or the aliased name for $current set via data-oj-as.
Properties of $current:
Name Type Argument Description footerTextstring <optional>
Column footer text isTabbableboolean Whether the cell is in tabbable mode or not. keyC Column key -
headerTemplate
-
The template for rendering each header cell in the table. When a column.headerTemplate is specified that will take precedence over this template. The slot content must be a template element. The content of the template should not include the th element, only its contents. The template has access to the context HeaderTemplateContext via $current or the aliased name for $current set via data-oj-as.
Properties of $current:
Name Type Argument Description headerTextstring <optional>
Column header text isTabbableboolean Whether the cell is in tabbable mode or not. keyC Column key -
noData
-
The template for rendering content when the table has an empty data set. The slot content must be a template element. If not specified then a default no data message will be displayed.
Properties of $current:
Name Type Description isTabbableboolean Whether the cell is in tabbable mode or not. -
DynamicSlots.CellTemplateContext (Dynamic)
-
Context passed into the cell template specified in the
column.templateproperty.Note: For additional information see .
Properties of $current:
Name Type Argument Description columnKeyC Column key dataD[keyof D] <optional>
Data for the cell, derived from the column.field property isTabbableboolean Whether the cell is in tabbable mode or not. itemItem.<K, D> Row item containing data and metadata -
DynamicSlots.FooterTemplateContext (Dynamic)
-
Context passed into the footer template specified in the
column.footerTemplateproperty.Note: For additional information see .
Properties of $current:
Name Type Argument Description footerTextstring <optional>
Column footer text isTabbableboolean Whether the cell is in tabbable mode or not. keyC Column key -
DynamicSlots.HeaderTemplateContext (Dynamic)
-
Context passed into the header template specified in the
column.headerTemplateproperty.Note: For additional information see .
Properties of $current:
Name Type Argument Description headerTextstring <optional>
Column header text isTabbableboolean Whether the cell is in tabbable mode or not. keyC Column key
Attributes
-
column-order :Array<C>
-
Controls the displayed columns and their order. An array of column keys that represents the displayed columns and the order to display them in. If not set, all columns will be displayed in the order returned by
Object.keys(columns).- Supports writeback:
true
Names
Item Name Property columnOrderProperty change event columnOrderChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-column-order-changed -
column-widths :Record<C, number>
-
The desired widths of the specified table columns. A record mapping columns keys to numbers representing pixel widths for each column. Values should only be provided when a specific width is desired for a column as values provided will override the Table's normal column sizing calculations. Applications should avoid setting widths for every column in most cases as doing so will likely result in a non-responsive layout.
- Supports writeback:
true
Names
Item Name Property columnWidthsProperty change event columnWidthsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-column-widths-changed -
columns :Record.<C, oj-c.Table.Column.<K, D>>
-
The set of columns that can be displayed in the Table. If no
columns-orderis specified, all columns specified will be displayed in the order returned byObject.keys(columns). Otherwise only the columns specified in thecolumns-ordervalue will be displayed.Names
Item Name Property columnsProperty change event columnsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-columns-changed -
(readonly) current-cell :(oj-c.Table.NoDataCell|oj-c.Table.DataCell.<K, C>|oj-c.Table.HeaderCell.<C>|oj-c.Table.FooterCell.<C>)
-
The cell currently being used as the target for keyboard gestures made on the Table. This value will be updated as a user interacts with the Table. It will not be updated due to the Table losing browser focus alone, but may be updated due to the Table receiving browser focus. The current cell can be programatically updated by providing a new value for the
current-cell-overrideattribute.- Supports writeback:
true
Names
Item Name Property currentCellProperty change event currentCellChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-current-cell-changed -
current-cell-override :(oj-c.Table.NoDataCell|oj-c.Table.DataCellRowOverride.<K, C>|oj-c.Table.DataCellColumnOverride.<K, C>|oj-c.Table.DataCellTypeOverride.<K, C>|oj-c.Table.HeaderCellColumnOverride.<C>|oj-c.Table.HeaderCellTypeOverride.<C>|oj-c.Table.FooterCellColumnOverride.<C>|oj-c.Table.FooterCellTypeOverride.<C>)
-
The cell override to apply to the current cell of the Table. In order for this property to be honored, a new object instance must be set. Any or all aspects of a valid
DataCell,HeaderCell, orFooterCellcan be overridden. For instance, if the current cell is a data cell in the third row and second column, providing an override with onlytype: 'header'will result in the second column's header cell becoming current. Providing an override with onlycolumnKey: [fourth column key]instead will result in the data cell in the third row and fourth column becoming current.Names
Item Name Property currentCellOverrideProperty change event currentCellOverrideChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-current-cell-override-changed -
data :DataProvider.<K, D>
-
The data provider for Table.
Names
Item Name Property dataProperty change event dataChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed -
horizontal-grid-visible :"enabled"|"disabled"
-
Controls the display of the Table's horizontal gridlines.
- Default Value:
"enabled"
Supported Values:
Value Description disabledDo not display horizontal gridlines enabledDisplay horizontal gridlines Names
Item Name Property horizontalGridVisibleProperty change event horizontalGridVisibleChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-horizontal-grid-visible-changed -
layout :"contents"|"fixed"
-
The column sizing method used for the Table's columns.
- Default Value:
"contents"
Supported Values:
Value Description contentsWhen specified, the initial column sizes are determined by the contents of the data. Does not require an overall width set on the Table. Can have performance issues when large numbers of columns and/or rows are initially rendered. fixedWhen specified, the initial column sizes are determined by column weights. Requires an overall width set on the Table (width='100%', width='200rem', etc.) Very performant when rendering large numbers of columns and/or rows. Names
Item Name Property layoutProperty change event layoutChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-layout-changed -
row :{ accessibleRowHeader?: C | C[] | ((context: oj-c.Table.RowContext<K, D>) => C | C[]); }
-
A subset of attributes for controlling certain behaviors on a per row basis.
Names
Item Name Property rowProperty change event rowChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-row-changed -
scroll-policy-options :{ fetchSize?: number; }
-
Options related to the Table's fetching and scrolling behaviors.
Names
Item Name Property scrollPolicyOptionsProperty change event scrollPolicyOptionsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-scroll-policy-options-changed -
scroll-policy-options.fetch-size :number
-
The number of records the Table will request during each data fetch.
- Default Value:
25
Names
Item Name Property scrollPolicyOptions.fetchSize -
select-all-control :"hidden"|"visible"
-
Controls the display of the Table's select all control when multiple row selection is enabled.
- Default Value:
"visible"
Supported Values:
Value Description hiddenDo not display the select all control visibleDisplay the select all control Names
Item Name Property selectAllControlProperty change event selectAllControlChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-select-all-control-changed -
selected :{ column?: ImmutableKeySet<C>; row?: ImmutableKeySet<K>; }
-
The selected rows and/or columns.
- Supports writeback:
true
Names
Item Name Property selectedProperty change event selectedChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selected-changed -
selection-mode :{ column?: 'none' | 'single' | 'multiple'; row?: 'none' | 'single' | 'multiple'; }
-
Specifies whether row and/or column selection gestures are enabled on the Table, and the cardinality of each (single/multiple/none). If
singleormultipleis specified, selection gestures will be enabled. Otherwise, selection gestures will be disabled. This attribute has no effect on the Table's selection styling as styling will be applied to any rows and/or columns specified by theselectedattribute regardless of the type of selection gestures enabled. Changing the value of this attribute will not affect the value of theselectedattribute.Names
Item Name Property selectionModeProperty change event selectionModeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-mode-changed -
selection-mode.column :"none"|"single"|"multiple"
-
Specifies whether column selection gestures are enabled on the Table.
- Default Value:
"none"
Supported Values:
Value Description multipleAny number of columns can be selected via user gestures. noneColumn selection gestures are disabled. singleA maximum of 1 column can be selected via user gestures. Names
Item Name Property selectionMode.column -
selection-mode.row :"none"|"single"|"multiple"
-
Specifies whether row selection gestures are enabled on the Table.
- Default Value:
"none"
Supported Values:
Value Description multipleAny number of rows can be selected via user gestures. noneRow selection gestures are disabled. singleA maximum of 1 row can be selected via user gestures. Names
Item Name Property selectionMode.row -
vertical-grid-visible :"enabled"|"disabled"
-
Controls the display of the Table's vertical gridlines.
- Default Value:
"disabled"
Supported Values:
Value Description disabledDo not display vertical gridlines enabledDisplay vertical gridlines Names
Item Name Property verticalGridVisibleProperty change event verticalGridVisibleChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-vertical-grid-visible-changed
Events
-
ojRowAction
-
Triggered when a user performs an action gesture on a row. Action gestures include when a user clicks (or taps) anywhere in a data cell, or presses the enter or space keys while a data cell or its content has browser focus.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description contextoj-c.Table.RowContext.<K, D> Row context
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description propertyThe property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesAn object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description propertyThe property name to set. Supports dot notation for subproperty access. valueThe new value to set the property to. Returns:
- Type
- void
Type Definitions
-
CellPadding
-
Specifies whether padding is enabled or disabled on specific sides of a cell.
Properties:
Name Type Argument Description bottom"disabled" | "enabled" <optional>
Specifies whether bottom padding is enabled or disabled. end"disabled" | "enabled" <optional>
Specifies whether end padding (right in ltr locales, left in rtl locales) is enabled or disabled. start"disabled" | "enabled" <optional>
Specifies whether start padding (left in ltr locales, right in rtl locales) is enabled or disabled. top"disabled" | "enabled" <optional>
Specifies whether top padding is enabled or disabled. -
Column<K,D>
-
Specifies the properties of a column.
Properties:
Name Type Argument Description fieldkeyof D <optional>
Specifies the field attribute of the row item data that is mapped to the column. footerPaddingstring | oj-c.Table.CellPadding <optional>
Specifies padding for the footer cell in this column. Valid string values include 'enabled' and 'disabled'. Setting either 'enabled' or 'disabled' will apply to all sides of the footer cell, while providing an instance of CellPadding will only apply to the specified sides of the footer cell. footerTemplatestring <optional>
The name of the slot used to specify the template for rendering the footer cell in the column. The slot content must be a template element. The content of the template should not include the td element, only its contents. The template has access to the context FooterTemplateContext via $current or the aliased name for $current set via data-oj-as. footerTextstring <optional>
Text to display in the footer cell of the column footerTooltip"disabled" | "enabled" <optional>
Specifies whether the default tooltip is enabled for the footer cell in this column. Valid string values include 'enabled' and 'disabled'. headerPaddingstring | oj-c.Table.CellPadding <optional>
Specifies padding for the header cell in this column. Valid string values include 'enabled' and 'disabled'. Setting either 'enabled' or 'disabled' will apply to all sides of the header cell, while providing an instance of CellPadding will only apply to the specified sides of the header cell. headerTemplatestring <optional>
The name of the slot used to specify the template for rendering the header cell in the column. The slot content must be a template element. The content of the template should not include the th element, only its contents. The template has access to the context HeaderTemplateContext via $current or the aliased name for $current set via data-oj-as. headerTextstring <optional>
Text to display in the header cell of the column. headerTooltip"disabled" | "enabled" <optional>
Specifies whether the default tooltip is enabled for the header cell in this column. Valid string values include 'enabled' and 'disabled'. horizontalAlignment"center" | "end" | "start" | "left" | "right" <optional>
The horizontal alignment of the column. maxWidthnumber <optional>
The maximum width in pixels of the column. This value is used during initial render, and does not affect the ability to resize the column. This value is applicable when either, layout='fixed' or layout='contents'. minWidthnumber <optional>
The minimum width in pixels of the column. This value is used during initial render, and does not affect the ability to resize the column. This value is applicable when either, layout='fixed' or layout='contents'. If not set and layout='fixed' a default minimum width will be determined by the theme. paddingstring | oj-c.Table.CellPadding | (context: oj-c.Table.RowContext<K, D>) => "disabled" | "enabled" | oj-c.Table.CellPadding <optional>
Specifies padding for the data cells in this column. Valid string values include 'enabled' and 'disabled'. Setting either 'enabled' or 'disabled' will apply to all sides of the data cells, while providing an instance of CellPadding will only apply to the specified sides of the data cells. sticky"disabled" | "enabled" <optional>
Whether this column should be prevented from scrolling out of view. templatestring <optional>
The name of the slot used to specify the template for rendering data cells in the column. The slot content must be a template element. The content of the template should not include the td element, only its contents. The template has access to the context CellTemplateContext via $current or the aliased name for $current set via data-oj-as. tooltipstring | (context: oj-c.Table.RowContext<K, D>) => "disabled" | "enabled" <optional>
Specifies whether default tooltips are enabled for data cells in this column. Valid string values include 'enabled' and 'disabled'. weightnumber <optional>
Specifies the relative sizing weight of the column. If not set a default of 1 is assumed. This must be a positive number greater than or equal to 1. Its value does not affect the ability to resize the column. When the Table's layout attribute is set to fixed, this value is used to determine the relative width of the column compared to the other columns. For example, a column with a weight of 2 will have twice as much space allocated to it as a column with a weight of 1. This value has no effect when the table's layout attribute is set tocontents. -
DataCell<K,C>
-
Specifies a data cell.
Properties:
Name Type Description columnKeystring | C Specifies the column key of the cell. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. rowKeyK Specifies the row key of the cell. type"data" Specifies the the type of the cell. -
DataCellColumnOverride<K,C>
-
Specifies a column override for a data cell. If only a
columnKeyis provided, using this as an override will attempt to keep the the current row the same and only change the current column. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. rowKeyK <optional>
Specifies the row key of the cell override. type"data" <optional>
Specifies the type of the cell override. -
DataCellRowOverride<K,C>
-
Specifies a row override for a data cell. If only a
rowKeyis provided, using this as an override will attempt to keep the the current column the same and only change the current row. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C <optional>
Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. rowKeyK Specifies the row key of the cell override. type"data" <optional>
Specifies the type of the cell override. -
DataCellTypeOverride<K,C>
-
Specifies a type override for a data cell. If only a
typeis provided, using this as an override will attempt to keep the the current column the same and change to the first data row. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C <optional>
Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. rowKeyK <optional>
Specifies the row key of the cell override. type"data" Specifies the type of the cell override. -
FooterCell<C>
-
Specifies a footer cell.
Properties:
Name Type Description columnKeystring | C Specifies the column key of the cell. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"footer" Specifies the type of the cell. -
FooterCellColumnOverride<C>
-
Specifies a column override for a footer cell. If only a
columnKeyis provided, using this as an override will only change the current column. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"footer" <optional>
Specifies the type of the cell override. -
FooterCellTypeOverride<C>
-
Specifies a type override for a footer cell. If only a
typeis provided, using this as an override will attempt to keep the the current column the same and make a footer cell current. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C <optional>
Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"footer" Specifies the type of the cell override. -
HeaderCell<C>
-
Specifies a header cell.
Properties:
Name Type Description columnKeystring | C Specifies the column key of the cell. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"header" Specifies the type of the cell. -
HeaderCellColumnOverride<C>
-
Specifies a column override for a header cell. If only a
columnKeyis provided, using this as an override will only change the current column. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"header" <optional>
Specifies the type of the cell override. -
HeaderCellTypeOverride<C>
-
Specifies a type override for a header cell. If only a
typeis provided, using this as an override will attempt to keep the the current column the same and make a header cell current. See thecurrent-cell-overrideattribute for more details.Properties:
Name Type Argument Description columnKeystring | C <optional>
Specifies the column key of the cell override. Valid values include 'oj-c-table_selection' when multiple row selection is enabled. type"header" Specifies the type of the cell override. -
NoDataCell
-
Specifies a no data cell.
Properties:
Name Type Description type"noData" Specifies the type of the cell. -
RowContext<K,D>
-
Context used to specify the row of a Table.
Properties:
Name Type Description itemItem.<K, D> Row item containing data and metadata