DTO_BaseTable
Class · Group: Data Transfer Objects
@JsonAccess(serializable='always' deserializable='always') global virtual class DTO_BaseTable extends DTO_JsonBaseExtends: DTO_JsonBase
A Data Transfer Object (DTO) class that structures webservice handler responses into a common table format, providing column and row handling for a unified data view. Supports functionality for dynamic column definition and row addition.
Since: 1.0
Example:
DTO_BaseTable table = new DTO_BaseTable();
table.addColumn('Account Name', 'name', 'text', true);
table.addColumn('Revenue', 'revenue', 'currency');
table.addRow(new Map<String, Object>{'name' => 'Acme Corp', 'revenue' => 50000});Properties
| Property | Description |
|---|---|
| global List columns | Retrieves the list of columns defined in the table. |
| global List rows | Retrieves all rows added to the table. |
Fields
| Field | Description |
|---|---|
| global transient List tableColumns | List of table columns within this table |
| global transient List tableRows | List of table rows within this table |
Methods
| Method | Description |
|---|---|
| global void addColumn(String label, String fieldName, String type) | Adds a new column to the table with the specified label, field name, and type. |
| global void addColumn(String label, String fieldName, String type, Boolean sortable) | Adds a new column to the table with specified label, field name, type, and sortable property. |
| global void addRow(Object anObject) | Adds a new data row to the table. |
Inner Classes
| Class | Description |
|---|---|
| DTO_Column | Represents a column in the DTO_BaseTable, containing properties for label, field name, type, and sorting ability. |
Property Details
columns
@AuraEnabled global List<DTO_BaseTable.DTO_Column> columnsType: List
Retrieves the list of columns defined in the table. Each column can have a label, field name, data type, and sortable setting. Enables access to the column definitions for display and sorting purposes.
Since:
Example:
rows
@AuraEnabled global List<Object> rowsType: List
Retrieves all rows added to the table. Each row contains data matching the fields and types specified in the column definitions.
Since:
Example:
Method Details
addColumn
global void addColumn(String label, String fieldName, String type)Adds a new column to the table with the specified label, field name, and type. The column will not be sortable by default. Useful for defining table structure for row data.
Parameters:
label(String) - The display text for the column header.fieldName(String) - The field name to map data from rows to this column.type(String) - The data type of the column (e.g., 'text', 'number'), see documentation for types here:
@link https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/documentation
Since: 1.0
Example:
instance.addColumn('My Label', 'myName', 'value');addColumn
global void addColumn(String label, String fieldName, String type, Boolean sortable)Adds a new column to the table with specified label, field name, type, and sortable property. Supports column sorting where applicable and customizable table views.
Parameters:
label(String) - The display text for the column header.fieldName(String) - The field name to map data from rows to this column.type(String) - The data type of the column (e.g., 'text', 'number').sortable(Boolean) - A Boolean indicating if the column should support sorting.
@link https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/documentation
Since: 1.0
Example:
instance.addColumn('My Label', 'myName', 'value', true);addRow
global void addRow(Object anObject)Adds a new data row to the table. The data should be structured to match the columns defined in the table. Extending classes may override this method for custom row handling.
Parameters:
anObject(Object) - The data object representing a row to be added to the table.
Since: 1.0
Example:
instance.addRow('value');Field Details
tableColumns
global transient List<DTO_BaseTable.DTO_Column> tableColumnsType: List
List of table columns within this table
Since: 1.0
Example:
DTO_BaseTable table = new DTO_BaseTable();
table.addColumn('Account Name', 'name', 'text', true);
table.addColumn('Revenue', 'revenue', 'currency');
List<DTO_BaseTable.DTO_Column> columns = table.tableColumns;tableRows
global transient List<Object> tableRowsType: List
List of table rows within this table
Since: 1.0
Example:
DTO_BaseTable table = new DTO_BaseTable();
table.addRow(new Map<String, Object>{'name' => 'Acme Corp', 'revenue' => 50000});
table.addRow(new Map<String, Object>{'name' => 'Global Inc', 'revenue' => 75000});
List<Object> rows = table.tableRows;