Contents

TableCellSelector

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

Declaration

object TableCellSelector

Properties

NameTypeDescription
columnIndexinteger

Specifies a column index. The leftmost column of data has an index of 0.

descriptorstring

Specifies the identifier of a specific data descriptor. All cells for this data descriptor will be selected. See DataDescriptor.

evenColumnsboolean

When true, selects the cells in even columns.

evenRowsboolean

When true, selects the cells in even rows.

oddColumnsboolean

When true, selects the cells in odd columns.

oddRowsboolean

When true, selects the cells in odd rows.

rowIndexinteger

Specifies a row index. The topmost row of data has an index of 0.

Discussion

Use the TableCellSelector object to set the criteria for applying conditional styles to rows. For example, you could set criteria to select a cell at a specific location or to select cells for a certain data descriptor.

You can use this object in ConditionalTableCellStyle.

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": {
        "headerCells": {
          "padding": 5,
          "textStyle": {
            "fontWeight": "bold",
            "fontStyle": "normal"
          }
        },
        "cells": {
          "padding": 2,
          "conditional": [
            {
              "selectors": [
                {
                  "oddRows": true
                }
              ],
              "backgroundColor": "#eeeeee"
            }
          ]
        }
      }
    }
  }
}

See Also

Table Styles