Contents

TableColumnSelector

The object for defining conditions that apply a conditional style to a column.

Declaration

object TableColumnSelector

Properties

NameTypeDescription
columnIndexinteger

A number that specifies a column index. The leftmost column of data has an index of 0. Only the column with the specific index is selected.

descriptorstring

A number that specifies the identifier of a specific data descriptor. All columns for this data descriptor are selected. See DataDescriptor.

When dataOrientation is set to vertical, which is the default, each column displays data for one data descriptor. See DataTable.

evenboolean

A Boolean value when true; selects the even columns.

oddboolean

A Boolean value when true; selects the odd columns.

Discussion

Use the TableColumnSelector object to set the criteria for applying conditional styles to columns. For example, you could set the criteria to select all even columns or to select columns for certain data descriptors.

You can use this object in ConditionalTableColumnStyle.

Example

{
  "components": [
    {
      "role": "datatable",
      "style": "bookTableStyle",
      "showDescriptorLabels": true,
      "sortBy": [
        {
          "descriptor": "id-publication-date",
          "direction": "ascending"
        }
      ],
      "data": {
        "descriptors": [
          {
            "identifier": "id-publication-date",
            "key": "publicationDate",
            "label": "Date",
            "dataType": "string"
          },
          {
            "identifier": "id-title",
            "key": "title",
            "label": "Title",
            "dataType": "string"
          },
          {
            "identifier": "id-publisher",
            "key": "publisher",
            "label": "Publisher",
            "dataType": "string"
          }
        ],
        "records": [
          {
            "title": "Mardi",
            "publicationDate": "1849",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Typee",
            "publicationDate": "1846",
            "publisher": "Wiley and Putnam"
          },
          {
            "title": "White-Jacket",
            "publicationDate": "1850",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Omoo",
            "publicationDate": "1847",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Redburn",
            "publicationDate": "1849",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Moby-Dick",
            "publicationDate": "1851",
            "publisher": "Harper & Brothers"
          }
        ]
      }
    }
  ],
  "componentStyles": {
    "bookTableStyle": {
      "tableStyle": {
        "columns": {
          "backgroundColor": "#eeeeee",
          "conditional": [
            {
              "selectors": [
                {
                  "columnIndex": 0
                }
              ],
              "backgroundColor": "#dddddd"
            }
          ]
        },
        "headerCells": {
          "padding": 5,
          "textStyle": {
            "fontWeight": "bold"
          }
        },
        "cells": {
          "padding": 2
        }
      }
    }
  }
}

See Also

Table Styles