DynamicTableView
Static Public Attributes
The DynamicTableView class has the following static public attributes:
const string ROW_ID_KEY = "_rowID" | Key that will be used for the row ID in the update callback. |
const string COLUMN_CONFIG_KEY = "_config" | Key that must be used in column definitions to specify the mandatory config that will be shown in the column. |
const string COLUMN_ID_KEY = "_colID" | Key that must be used in column definitions to specify the optional ID of the column. |
const string COLUMN_CONVERT_KEY = "_convert" | Key that must be used in column definitions to specify the optional value conversion method. |
const string COLUMN_HIDDEN_KEY = "_hidden" | Key that must be used in column definitions to specify that the column is hidden (only used for sorting and filtering), but its values will not be transmitted to the receiver. |
const string COLUMN_FAST_UPDATE_KEY = "_fastUpdate" | Key that identifies columns that should be optimized for frequent value updates. These columns cannot be used for sorting and filtering, but are therefore handled more efficiently when being updated. |
const int MAX_VIEW_ROW_COUNT = 200; | Maximum number of rows that can be displayed. |
DynamicTableView Class - Constructor
DynamicTableView(shared_ptr<void> receiver,
function_ptr updateCB = nullptr,
mixed userData = 0, // needs to be mixed because of default value
int blockingTime = -1,
function_ptr staticDataMapCB = nullptr,
function_ptr addDataMapCB = nullptr,
bool completeUpdates = false)
Parameters
Parameter | Description |
---|---|
receiver | Object instance that will receive all callbacks. |
updateCB |
Pointer to a method on "receiver" that will be called whenever the viewed part of the table changes. The function must have the following signature:
|
userData | Data that will be included in each call from this instance to a callback. |
blockingTime | Time range in msec where the call of the callback function is blocked by open queries. |
staticDataMapCB |
(optional) Pointer to a method on "receiver" that will be called before static data for a row ID is loaded. This method can add static data (keyed by column IDs) to the mapping passed as first parameter, and all static data
added this way is used without calling the column's _convert method. The function must have the following
signature:
|
addDataMapCB |
(optional) Pointer to a method on "receiver" that will be called before data for a row ID is sent to updateCB. This method can add data to the mapping passed as first parameter, and all data added this way is used without any
further processing, keys for these values must be different from column IDs used by this DynamicTableView. In
contrast to "staticDataMapCB" this is only called for rows that are actually sent to "updateCB", not for all rows
in the table. However, data is not cached, but "addDataMapCB" will be called every time before "updateCB" is
called. The function must have the following signature:
|
completeUpdates | (optional) If "true", every call to "updateCB" will be a complete update, containing all visible rows and not only changes to the last call. The default value is "false". |
This is an example using a receiver class called "Receiver":
class Receiver
{
// the update callback just shows the list of received changes
public updateCB(const anytype &userData, const mapping &changes)
{
DebugTN(changes);
}
// callback for static data: just invents some data on the fly
public string staticData(const anytype &userData, const string &rowID, const string &colID)
{
return strtoupper(rowID + "/" + colID);
}
// a simple value converter that converts to ulong
public ulong toUlong(const anytype &userData, const string &rowID, const string &colID, const anytype &value)
{
return (ulong)value;
}
};
main()
{
shared_ptr<Receiver> rcv = new Receiver();
DynamicTableView view = DynamicTableView(rcv, Receiver::updateCB);
// now use view.setDpeNames() or view.setQuery() to connect to data.
}
DynamicTableView member functions
- clearFilters
- dataToDisplay
- dataToDisplayAsUpdate
- disreconnect
- displayedCount
- displayedRowIds
- filteredCount
- filteredRowIds
- hasFilter
- hasSorting
- DynamicTableViewFilter
- reconnect
- resetSorting
- setDpeNames
- setFilter
- setFilters
- setQuery
- setSortColumn
- setSortColumns
- DynamicTableViewFilter
- unfilteredCount
- unfilteredRowIds