Start page / Template development / Template syntax / Data types / Table

Table data type

Value range of the Table data type

In FirstSpirit it is possible to enter data in tabular form. Such data is usually stored structured in XML markup language. This is necessary as (in addition to the rows and cells) several contents must contain special markups, highlighting and information for specific parts.

In order to be able to output or further process the contents stored in this way, these input components return an object of the data type Table .

Definition using the standard input components

Different input components can be defined in the form area of a page or section template. These form elements can then be used to insert the actual editorial contents into the page. The Standard input components supported by FirstSpirit return different data types.

The following standard input components return an object of data type Table :

Then, with the help of a $CMS_VALUE(...)$ instruction, methods can then be applied to this object:

$CMS_VALUE(IDENTIFIER.METHOD)$

Under IDENTIFIER, the resultname parameter, defined in the input component, must be specified.

Methods on Table objects

The table below lists all methods which can be invoked on objects of data type Table.

The object is generated by the following form objects:
CMS_INPUT_DOMTABLE
Method name Return type Brief description Available since
addColumn(int) void Adds a new column at the specified index. 4.0.17
addRow(int) void Adds a new row at the specified index. 4.0.17
deleteColumn(int) void Deletes the column with the specified index 4.0.17
deleteRow(int) void Deletes the row with the specified index 4.0.17
diff(Element) Element Compute a difference between this element and the given one. 4.0.59
equals(Object) boolean
getCell(int, int) TableCell Gets the cell of this table with the given row & col index or null if no cell exists with these indices. 4.0.17
getClass Class Class of the invoking object
getColumns int Number of columns in a table 4.0.17
getDom Element Returns the element node of this table. 4.0.17
getRows int Number of rows in a table 4.0.17
isCase(Object) boolean
isEmpty boolean Checks whether an expression is empty 4.0.17
isNull boolean Checks whether an expression is null (zero)
print void default print behaviour of a dom table: print all contained rows and cells 4.0.0
replace(Table) void Replaces this table with the given table. 4.0.36
set(String, Object) Object
toJSON String Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value. 5.2.11
toString String
type String

addColumn(int)

Adds a new column at the specified index.
Method name Return type Available since
addColumn(int) void 4.0.17

addRow(int)

Adds a new row at the specified index.
Method name Return type Available since
addRow(int) void 4.0.17

deleteColumn(int)

Deletes the column with the specified index
Method name Return type Available since
deleteColumn(int) void 4.0.17

deleteRow(int)

Deletes the row with the specified index
Method name Return type Available since
deleteRow(int) void 4.0.17

diff(Element)

Compute a difference between this element and the given one.
Method name Return type Available since
diff(Element) Element 4.0.59

equals(Object)

Method name Return type Available since
equals(Object) boolean

getCell(int, int)

Gets the cell of this table with the given row & col index or null if no cell exists with these indices.
Method name Return type Available since
getCell(int, int) TableCell 4.0.17

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getColumns

The .getColumns() (in Bean syntax: .columns) method returns the number of columns in a table.

The returned object is an integer (see java.lang.Integer).

Method name Return type Available since
getColumns int 4.0.17

getDom

Returns the element node of this table.
Method name Return type Available since
getDom Element 4.0.17

getRows

The .getRows() (in Bean syntax: .rows) method returns the number of rows in a table.

The returned object is an integer (see java.lang.Integer).

Method name Return type Available since
getRows int 4.0.17

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isEmpty

The .isEmpty() (in Bean syntax: .isEmpty) method checks whether an expression or object is empty, e.g. storeElement.isEmpty(). The result of the semantic check depends on the expression or object, e.g. a character string is empty if it does not contain any characters. In the case of objects with complex values or objects, the object decides when it is empty. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isEmpty() returns a Boolean value as the check result. true is the check result if the expression or object is empty and false if not.

Method name Return type Available since
isEmpty boolean 4.0.17

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

print

default print behaviour of a dom table: print all contained rows and cells
Method name Return type Available since
print void 4.0.0

replace(Table)

Replaces this table with the given table.
Method name Return type Available since
replace(Table) void 4.0.36

set(String, Object)

Method name Return type Available since
set(String, Object) Object

toJSON

Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value.
Method name Return type Available since
toJSON String 5.2.11

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.4 | Data privacy