Skip to content

Latest commit

 

History

History
66 lines (56 loc) · 4.05 KB

QueryTransformer.md

File metadata and controls

66 lines (56 loc) · 4.05 KB

QueryTransformer class

Description

Non-visual object to exchange data with the server. Gets list of columns from the server and sends transformation directives to the server.

Remarks

The columnsLoaded and dataReceived events must be handled in order to display data returned from the server.

const QT = new ActiveQueryBuilder.QueryTransformer("http://localhost:54459");
QT.pagination.skip( skipCount );
QT.pagination.take( takeCount );

var columns = [];
QT.on('columnsLoaded', function(_columns) {
    columns = _columns;
    QT.criteriaBuilder.init('criteriaBuilder');
    QT.transform(); // send request to server
}

QT.on('sendTransform', function() {
    //show loader
});

QT.on('dataReceived', function(rows) {
    renderTable(columns, rows); //display data table
    // hide loader
});
QT.loadColumns(); // get query columns

To save and restore the user's instructions between work sessions use the saveState and loadState methods. After restoring the component's state you can read user's instructions using the appropriate get* methods to set up HTML controls. The Criteria Builder control will be restored automatically.

Constructor:

Name Parameters Description
QueryTransformer url: string Creates new instance of the QueryTransformer class passing the URL of the server access point to exchange data with.

Properties:

Name Type Description
url (read-only) string Gets URL of the server access point to exchange data with.
filter (read-only) Filter Helper class to manipulate with filter conditions.
sortings (read-only) Sorting Helper class to manipulate with sortings.
hiddenColumns (read-only) HiddenColumn Helper class to manipulate with hidden columns.
pagination (read-only) Pagination Helper class to apply pagination.
totals (read-only) Total Helper class to define totals.
criteriaBuilder (read-only) CriteriaBuilder Gets access to the Criteria Builder visual control to define filter conditions.

Methods:

Name Parameters Return value Description
transform - - Sends transformation instructions to the server. The dataReceived event will be fired on receiving response from server.
loadColumns - - Sends request to get list of query columns. The columnsLoaded event will be fired on receiving response from server.
saveState - string Gets the component's state to save it between work sessions.
loadState state: string - Loads the component's state on resuming work session.
clear - - Deletes all transformation instructions.
clearAllForColumn columnName: string - Deletes all instructions for a column
getColumnList - array() Column Returns array of loaded columns.
columnByName columnName: string Column Returns Column object by column name.

Events:

Name Parameters Description
startColumnsLoading - Fired when the component sends the GetQueryColumns command to the server. You can display some animation until the process is completed.
columnsLoaded array() Column Fired when columns have been loaded from the server. Provides array of query columns returned from server. This event can be used to initialize the data HTML control by filling it's columns list.
changed QueryTransformer (self) Fired when the component's state has been changed (some instructions have been added or removed from the list).
sendTransform - Fired when the component sends the TransformSql command to the server. You can display some animation until the process is completed.
dataReceived Fired when data has been returned from the server. Result depends on the server-side handler.