TableCell {basictabler}R Documentation

R6 class that represents a cell in a table.

Description

The 'TableCell' class represents a cell in a table. Both header cells and body cells are represented by this class.

Format

R6Class object.

Active bindings

instanceId

An integer value that uniquely identifies this cell. NB: This number is guaranteed to be unique within the table, but the method of generation of the values may change in future, so you are advised not to base any logic on specific values.

cellType

One of the following values that specifies the type of cell: root, rowHeader, columnHeader, cell, total. The cellType controls the default styling that is applied to the cell.

rowNumber

The row number of the cell. 1 = the first (i.e. top) data row.

columnNumber

The column number of the cell. 1 = the first (i.e. leftmost) data column.

visible

TRUE or FALSE to specify whether the cell is rendered.

rawValue

The original unformatted value.

formattedValue

The formatted value (i.e. normally of character data type).

asNBSP

TRUE or FALSE to specify whether cells with no formatted value be output as html nbsp.

fValueOrNBSP

For internal use by the renderers only.

isMerged

For internal use by the renderers only.

isMergeRoot

For internal use by the renderers only.

mergeIndex

For internal use by the renderers only.

baseStyleName

The name of the style applied to this cell (a character value). The style must exist in the TableStyles object associated with the table.

style

A TableStyle object that can apply overrides to the base style for this cell.

Methods

Public methods


Method new()

Create a new 'TableCell' object.

Usage
TableCell$new(
  parentTable,
  rowNumber = NULL,
  columnNumber = NULL,
  cellType = "cell",
  visible = TRUE,
  rawValue = NULL,
  formattedValue = NULL,
  baseStyleName = NULL,
  styleDeclarations = NULL,
  asNBSP = FALSE
)
Arguments
parentTable

Owning table.

rowNumber

The row number of the cell. 1 = the first (i.e. top) data row.

columnNumber

The column number of the cell. 1 = the first (i.e. leftmost) data column.

cellType

One of the following values that specifies the type of cell: root, rowHeader, columnHeader, cell, total. The cellType controls the default styling that is applied to the cell.

visible

'TRUE' or 'FALSE' to specify whether the cell is rendered.

rawValue

The original unformatted value.

formattedValue

The formatted value (i.e. normally of character data type).

baseStyleName

The name of the style applied to this cell (a character value). The style must exist in the TableStyles object associated with the table.

styleDeclarations

A list containing CSS style declarations.

asNBSP

'TRUE' or 'FALSE' to specify whether cells with no formatted value be output as html nbsp.

Returns

No return value.


Method updatePosition()

Set the cell location in the table. Mainly exists for internal use. Typically used after rows/columns/cells are inserted or deleted (which shifts other cells).

Usage
TableCell$updatePosition(rowNumber = NULL, columnNumber = NULL)
Arguments
rowNumber

The row number of the cell. 1 = the first (i.e. top) data row.

columnNumber

The column number of the cell. 1 = the first (i.e. leftmost) data column.

Returns

No return value.


Method getCopy()

Stub only (ignore).

Usage
TableCell$getCopy()
Returns

No return value.


Method asList()

Return the contents of this object as a list for debugging.

Usage
TableCell$asList()
Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage
TableCell$asJSON()
Returns

A JSON representation of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage
TableCell$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# This class should only be created by using the functions in the table.
# It is not intended to be created by users outside of the table.
library(basictabler)
tbl <- qtbl(data.frame(a=1:2, b=3:4))
cell1 <- tbl$cells$setCell(r=4, c=1, cellType="cell", rawValue=5)
cell2 <- tbl$cells$setCell(r=4, c=2, cellType="cell", rawValue=6)
tbl$renderTable()

[Package basictabler version 1.0.2 Index]