Represents internal query structure.
Methods
getObject
Gets internal query object.
setObject
Sets internal query object. Accepts query representation in JSON format as well.
Parameters:
data
Type:Object | String
Internal query representation as pure JavaScript object or as JSON string
getModel
Gets DataModel object associated with this query.
setModel
Sets DataModel object associated with this query.
Parameters:
model
Type:Object
A DataModel object
toJSON
Returns JSON representation of this query.
isEmptyConditions
Returns true if query does not contain any condition.
clear
Clears query (all conditions and columns).
clearColumns
Clears all columns in query.
clearConditions
Clears all conditions in query.
setId
Sets query ID.
Parameters:
id
Type:String
New Query ID
setName
Sets query name.
Parameters:
name
Type:String
Query name
getColumns
Get array of columns.
addColumn
Adds new column with specified index.
Parameters:
column
Type:Object
The plain JavaScript object that defines a new column.
Code examples:
{
"caption" : "Company name",
"sorting" : "None",
"sortIndex" : -1,
"expr" : {
"typeName" : "ENTATTR",
"id" : "Customers.Company"
}
}
index
Type:Number
The index of new column
moveColumn
Moves the column with specified index to another position.
Parameters:
index1
Type:Number
The index of the column that should be moved.
index2
Type:Number
The index of the position the column should be moved to
removeColumn
Removes the column.
Parameters:
column
Type:Object
The column to be removed.
addChangedCallback
Adds a handler for “query changed” event.
Parameters:
callback
Type:Function
The function that will be called when query is changed.
This function can take one parameter - the object which contains information what change exactly occurred.
changeType
Type:String
Contains the reason of change. The value consists of two parts separated by dot.
First part can be “condition” or “column” and tells where exactly the modification occurred.
Second part tells more about the type of that modification: “add”, “delete”, “move”, etc.
For example: “condition.add” means that a new condition was added into the query
condition
Type:Object
Represents condition which was added or modified
Can be undefined (if the query change was made in columns)
column
Type:Object
Represents condition which was added or modified
Can be undefined (if the query change was made in conditions)
removeChangedCallback
Removes a handler for “query changed” event.
Parameters:
callback
Type:Function
A callback function that should be removed from the list of handlers.