JSViewDatasource
Overview
A JSViewDataSource
provides methods for managing and manipulating view-based data sources in Servoy. It enables the retrieval of column names, creation and management of view foundsets, and dynamic querying capabilities. Methods include obtaining column names through getColumnNames()
, fetching the data source string with getDataSource()
, and accessing the ViewFoundSet
with getFoundSet()
.
Additionally, getViewFoundSet(query)
creates and optionally registers view foundsets from a specified query object. The system retains registered view foundsets in memory until explicitly disposed of using dispose()
. The unregister()
method facilitates removing view foundsets associated with the datasource, optimizing memory management.
For more details, refer to ViewDataSource Documentation.
Methods Summarized
Get the column names of a datasource.
Get the datasource string.
Returns the ViewFoundSet that was previously created and registered by a call t o #getViewFoundSet(QBSelect) or #getViewFoundSet(QBSelect,boolean) with the register boolean to true.
Creates a view foundset with the provided query and automatically registers it.
Creates a view foundset with the provided query and the option to register it.
Unregisters a view foundset associated to this view datasource.
Methods Detailed
getColumnNames()
Get the column names of a datasource.
Returns: Array String[] column names
getDataSource()
Get the datasource string.
Returns: String String datasource
Sample
getFoundSet()
Returns the ViewFoundSet that was previously created and registered by a call t o #getViewFoundSet(QBSelect) or #getViewFoundSet(QBSelect,boolean) with the register boolean to true. It will return null when it can't find a ViewFoundSet for this datasource.
Returns: JSFoundSet A new ViewFoundSet for the datasource.
Sample
getViewFoundSet(query)
Creates a view foundset with the provided query and automatically registers it. Registered ViewFoundSets will be kept in memory by the system until ViewFoundSet.dispose() is called.
Parameters
QBSelect query a QBSelect query object
Returns: JSFoundSet the registered view foundset, or null if the datasource columns do not match with the query columns
Sample
getViewFoundSet(query, register)
Creates a view foundset with the provided query and the option to register it. A registered ViewFoundSets will be kept in memory by the system until ViewFoundSet.dispose() is called.
Parameters
Returns: JSFoundSet the registered view foundset, or null if the datasource columns do not match with the query columns
Sample
unregister()
Unregisters a view foundset associated to this view datasource.
Returns: Boolean true if the view foundset was unregistered, false otherwise
Sample
Last updated