Object

TableRowStyle

The object for applying styles to rows in a table.

Properties

backgroundColor

The background color for the table row.

If this property is omitted, the background is transparent.

The cell background color is highest priority, followed by the column, and finally the row. All three colors are applied, meaning that non-opaque values can cause combined colors. For example, using a red row together with a blue column, both with 50% opacity, creates a purple cell.

An array of styles to be applied only to rows that meet specified conditions. This can be used to create a table with alternating row background colors.

The stroke style for the divider lines between rows.

height
*

The height of the table row, as an integer in points, or using the available units for components.

By default, the height of each row is determined by the height of the content in that row. See Specifying Measurements for Components.

Discussion

You can apply styles that affect the look of the table rows, including the row background color, the color of the divider lines between rows, and the height of a row. For example, you could add a blue background color and apply a medium-gray divider to each row in your table.

You can also set up conditional row styles—styles that are applied only to rows that meet certain criteria. For example, you could apply a background shading to all odd-numbered rows. See ConditionalTableRowStyle.

This object can be used in TableStyle.

Example

{ "components": [ { "role": "datatable", "style": "exampleTableStyle", "showDescriptorLabels": true, "sortBy": [ { "descriptor": "id-name", "direction": "descending" } ], "data": { "descriptors": [ { "identifier": "id-name", "key": "name", "label": { "type": "formatted_text", "text": "Name", "textStyle": { "textColor": "black" } }, "dataType": "string" }, { "identifier": "id-occupation", "key": "occupation", "label": "Occupation", "dataType": "string" } ], "records": [ { "name": "Amelia Earhart", "occupation": "Pilot" }, { "name": "Grace Hopper", "occupation": "Computer Scientist" } ] } } ], "componentStyles": { "exampleTableStyle": { "tableStyle": { "rows": { "backgroundColor": "#fff", "divider": { "width": 1, "color": "#ddd" }, "conditional": [ { "selectors": [ { "even": true } ], "backgroundColor": "#eeeeee" } ] }, "headerRows": { "backgroundColor": "#ccc", "divider": { "width": 2, "color": "#999" } }, "cells": { "padding": 6, "verticalAlignment": "top" } } } }}

See Also

Table Styles

Defining and Using Table Styles

Apply table styles, such as borders and backgrounds, to the rows, columns, and cells in your HTML and JSON tables.

object TableStyle

The object for defining a style for rows, columns, cells, and headers in a table.

object ConditionalTableRowStyle

The object for applying styles to table rows that meet certain conditions.

object TableRowSelector

The object for defining conditions that will cause a conditional style to be applied to a row.

object TableColumnStyle

The object for applying styles to columns in a table.

object ConditionalTableColumnStyle

The object for applying styles to table columns that meet certain conditions.

object TableColumnSelector

The object for defining conditions that will cause a conditional style to be applied to a column.

object TableCellStyle

The object for applying styles to cells in a table.

object ConditionalTableCellStyle

The object for applying a style to table cells that meet certain conditions.

object TableCellSelector

The object for defining conditions that will cause a conditional style to be applied to a cell.

object TableBorder

The object for setting borders for tables.

object TableStrokeStyle

The object for defining the color, width, and style of a stroke in a table.

object Padding

The object for defining space around the content in a table cell.

object FormattedText

The object for specifying formatted text content and styling for captions in table cells.