DataTable
Overview
The DataTable is one of the core classes in Data Abstract for operating with tabled data. It is used to represent the client version of an individual record set, or data table, that has been retrieved from the server.
A DataTable contains an array of rows containing the actual data, and also maintains information about any changes that may have been made to these rows locally, but that have not yet been sent back to the server. Each row is represented by a DataRow instance, and contains data as specified by a list of DataColumns. Fields can either be real
fields, for which the data is contained within the table itself, or Calculated and Lookup Fields, where the value is determined at runtime, when needed.
The DataTable class is tightly connected with DataTableView class which represents a projection of the data table rows and can be useful when outputing table data in UI.
Location
- Reference: com.remobjects.dataabstract.jar
- Package: com.remobjects.dataabstract.data
- Ancestry: Object | DataTable
constructor
Creates an instance of DataTable
constructor
DataTable()
constructor (String)
Creates an instance of DataTable with the given name.
constructor(aName: String)
DataTable(String aName)
Parameters:
- aName: A name of a new table.
acceptChanges
Accepts all changes in rows of the table. After this method's call all rows should have status "Unchanged".
method acceptChanges
void acceptChanges()
acceptChangesForRow
Accepts changes for one particular row of the table. Checks that row is assigned and belongs to the current table.
Parameters:
- aRow: A row to mark.
addDynamicOrder
Add Dynamic Order condition
method addDynamicOrder(aFieldName: String; aDescending: Boolean)
void addDynamicOrder(String aFieldName, Boolean aDescending)
Parameters:
- aFieldName: field name
- aDescending: order
addNewRow
Creates and adds new row for the table. Returned ro has initializaed place to hold the data according to the table's scrtucture.
addTableChangedListener
Adds a subscriber to the table's notifications.
method addTableChangedListener(aListener: TableChangedListener)
void addTableChangedListener(TableChangedListener aListener)
Parameters:
- aListener: A subscriber/listener of notifications.
addTableDataChangedListener
Adds a subscriber to the table's data changing notifications.
method addTableDataChangedListener(aListener: TableDataChangedListener)
void addTableDataChangedListener(TableDataChangedListener aListener)
Parameters:
- aListener: A subscriber/listener of notifications.
beginLoadData
Sets the state of the table for further loading of data in it. Always call endLoadData after loading finished. While loading, no notifications are triggered.
method beginLoadData
void beginLoadData()
cancelChanges
It's the method of logically opposite action to the acceptChanges - it reverts all changes id table's rows. After its call all rows are in "Unchanged" state with old data; all new rows are deleted, all deleted rows are restored.
method cancelChanges
void cancelChanges()
cancelChangesForRow
Reverts changes for one particular row of the current table. Checks that row is assigned and belongs to the current table. Note, that "Added' row will be detashed from the table.
Parameters:
- aRow: A row to revert.
clear
Removes all rows from the current table.
method clear
void clear()
clone
Clones the current table along with its structure into newly creatd table object. No rows are copied, it affects structure and properties only.
Columns
property Columns: DataColumnCollection read;
DataColumnCollection Columns { __get; }
copy
Copies all table in new instance "as is". Additionally to clone it also copies data rows into new instance.
DynamicOrder
This property is used for Dynamic Order feature.
property DynamicOrder: array of String read write;
String[] DynamicOrder { __get; __set; }
endLoadData
Resets the loading state of the table. Call it after beginLoadData and loading of the data itself. If data was loaded during loading
state, correspondent events are fired on this method call.
method endLoadData
void endLoadData()
ExtendedProperties
property ExtendedProperties: PropertyCollection read;
PropertyCollection ExtendedProperties { __get; }
getChangedRows
Returns a collection of changed rows. Rows are not copied, it just a collection of references.
getChanges
The method is similar with getChangedRows with one difference though: a newly copy of table is created and filled with copies of changed rows from original table. Thus - on methoŠ² return - you will have a table all rows of which are modified.
isDataLoading
Returns whether or not the table is in loading
state.
method isDataLoading: Boolean
Boolean isDataLoading()
isInitialized
Returns whether or not the table has been initialized (i.e. table structure is filled with columns, primary keys (if any) are set).
method isInitialized: Boolean
Boolean isInitialized()
loadDataRow
Parameters:
- data:
PrimaryKey
property PrimaryKey: array of DataColumn read write;
DataColumn[] PrimaryKey { __get; __set; }
removeTableChangedListener
Unsubscribes the given subscriber from the table notifications.
method removeTableChangedListener(aListener: TableChangedListener)
void removeTableChangedListener(TableChangedListener aListener)
Parameters:
- aListener: A subscriber to unsubscribe.
removeTableDataChangedListener
Unsubscribes the given subscriber from the table data changing notifications.
method removeTableDataChangedListener(aListener: TableDataChangedListener)
void removeTableDataChangedListener(TableDataChangedListener aListener)
Parameters:
- aListener: A subscriber to unsubscribe.
Rows
property Rows: DataRowCollection read;
DataRowCollection Rows { __get; }
TableName
property TableName: String read write;
String TableName { __get; __set; }
Columns
property Columns: DataColumnCollection read;
DataColumnCollection Columns { __get; }
DynamicOrder
This property is used for Dynamic Order feature.
property DynamicOrder: array of String read write;
String[] DynamicOrder { __get; __set; }
ExtendedProperties
property ExtendedProperties: PropertyCollection read;
PropertyCollection ExtendedProperties { __get; }
PrimaryKey
property PrimaryKey: array of DataColumn read write;
DataColumn[] PrimaryKey { __get; __set; }
Rows
property Rows: DataRowCollection read;
DataRowCollection Rows { __get; }
TableName
property TableName: String read write;
String TableName { __get; __set; }
constructor
Creates an instance of DataTable
constructor
DataTable()
constructor (String)
Creates an instance of DataTable with the given name.
constructor(aName: String)
DataTable(String aName)
Parameters:
- aName: A name of a new table.
acceptChanges
Accepts all changes in rows of the table. After this method's call all rows should have status "Unchanged".
method acceptChanges
void acceptChanges()
acceptChangesForRow
Accepts changes for one particular row of the table. Checks that row is assigned and belongs to the current table.
Parameters:
- aRow: A row to mark.
addDynamicOrder
Add Dynamic Order condition
method addDynamicOrder(aFieldName: String; aDescending: Boolean)
void addDynamicOrder(String aFieldName, Boolean aDescending)
Parameters:
- aFieldName: field name
- aDescending: order
addNewRow
Creates and adds new row for the table. Returned ro has initializaed place to hold the data according to the table's scrtucture.
addTableChangedListener
Adds a subscriber to the table's notifications.
method addTableChangedListener(aListener: TableChangedListener)
void addTableChangedListener(TableChangedListener aListener)
Parameters:
- aListener: A subscriber/listener of notifications.
addTableDataChangedListener
Adds a subscriber to the table's data changing notifications.
method addTableDataChangedListener(aListener: TableDataChangedListener)
void addTableDataChangedListener(TableDataChangedListener aListener)
Parameters:
- aListener: A subscriber/listener of notifications.
beginLoadData
Sets the state of the table for further loading of data in it. Always call endLoadData after loading finished. While loading, no notifications are triggered.
method beginLoadData
void beginLoadData()
cancelChanges
It's the method of logically opposite action to the acceptChanges - it reverts all changes id table's rows. After its call all rows are in "Unchanged" state with old data; all new rows are deleted, all deleted rows are restored.
method cancelChanges
void cancelChanges()
cancelChangesForRow
Reverts changes for one particular row of the current table. Checks that row is assigned and belongs to the current table. Note, that "Added' row will be detashed from the table.
Parameters:
- aRow: A row to revert.
clear
Removes all rows from the current table.
method clear
void clear()
clone
Clones the current table along with its structure into newly creatd table object. No rows are copied, it affects structure and properties only.
copy
Copies all table in new instance "as is". Additionally to clone it also copies data rows into new instance.
endLoadData
Resets the loading state of the table. Call it after beginLoadData and loading of the data itself. If data was loaded during loading
state, correspondent events are fired on this method call.
method endLoadData
void endLoadData()
getChangedRows
Returns a collection of changed rows. Rows are not copied, it just a collection of references.
getChanges
The method is similar with getChangedRows with one difference though: a newly copy of table is created and filled with copies of changed rows from original table. Thus - on methoŠ² return - you will have a table all rows of which are modified.
isDataLoading
Returns whether or not the table is in loading
state.
method isDataLoading: Boolean
Boolean isDataLoading()
isInitialized
Returns whether or not the table has been initialized (i.e. table structure is filled with columns, primary keys (if any) are set).
method isInitialized: Boolean
Boolean isInitialized()
loadDataRow
Parameters:
- data:
removeTableChangedListener
Unsubscribes the given subscriber from the table notifications.
method removeTableChangedListener(aListener: TableChangedListener)
void removeTableChangedListener(TableChangedListener aListener)
Parameters:
- aListener: A subscriber to unsubscribe.
removeTableDataChangedListener
Unsubscribes the given subscriber from the table data changing notifications.
method removeTableDataChangedListener(aListener: TableDataChangedListener)
void removeTableDataChangedListener(TableDataChangedListener aListener)
Parameters:
- aListener: A subscriber to unsubscribe.