Represents Query.
Index
Constructors
Public Properties
- attributeExprTag
- clientListRequestHandler
- extraData
- innerData
- isNewbie
- model
- serverListRequestHandler
- timezoneOffset
Protected Properties
Public Methods
- addChangedCallback
- addColumn
- addColumnObj
- addConditionGroup
- addDrillDown
- addExtraConditionGroup
- addProcessCallback
- addSimpleCondition
- addSimpleExtraCondition
- changeColumnType
- clear
- clearColumns
- clearConditions
- clearDrillDowns
- clearExtraConditions
- createColumn
- createCondition
- findColumnById
- fireChangedEvent
- fireColumnsChangedEvent
- fireConditionsChangedEvent
- fireProcessEvent
- getAggregatedColumns
- getColumnById
- getColumnSortIndex
- getColumns
- getConditionsText
- getConditionsTextAsHtml
- getDescription
- getDrillDowns
- getId
- getJustSortedColumns
- getModel
- getName
- getOneValueForAttr
- getParentQuery
- getRootCondition
- getSortedColumns
- getUsedInTotalsColumns
- hasEnabledAggrColumns
- isEmpty
- isEmptyColumns
- isEmptyConditions
- isEx
- isModified
- loadFromData
- loadFromDataOrJson
- loadFromJson
- loadModelData
- moveColumn
- regenerateId
- removeChangedCallback
- removeColumn
- removeColumns
- removeProcessCallback
- reset
- resetModified
- runThroughConditions
- setDefaultName
- setDescription
- setId
- setModel
- setName
- toJSON
- toJSONData
- tryValidate
- validate
Protected Methods
Constructors
constructor
The default constructor. ⊕ new Query(model?: DataModel,data?: QueryData,options?: QueryOptions): Query
Parameters:
- model: DataModel, Optional - The data model.
- data: QueryData, Optional - JSON representation object.
- options: QueryOptions, Optional - The options.
Public Properties
attributeExprTag
The attributec class name (Tag).
● attributeExprTag: ExprTag
clientListRequestHandler
● clientListRequestHandler: any
extraData
Contains user-defined extra data for current query.
● extraData: any
innerData
● innerData: any
isNewbie
● isNewbie: boolean
= true
model
The Data Model associated with this query.
● model: DataModel
serverListRequestHandler
● serverListRequestHandler: any
timezoneOffset
Current timezone offset (it's sent to the server for proper date/time values processing).
● timezoneOffset: number
Protected Properties
extraConditions
● extraConditions: Condition
Public Methods
addChangedCallback
Add changed callback
▸ addChangedCallback(callback: (event: EqEvent
) => void
): string
Parameters:
- callback: (event:
EqEvent
) =>void
- The callback ID.
Returns string
addColumn
Adds a new column with specified parameters
▸ addColumn(descriptor: ColumnDescriptor,author?: string
): QueryColumn
Parameters:
- descriptor: ColumnDescriptor
- author:
string
, Optional - The author of this operation. This parameter is used in EasyQuery widgets only to indicate which of the initiates the change.
Returns QueryColumn
Example:
query.addColumn({
attributeId: 'Customers.CompanyName',
sortIndex: SortDirection.Ascending
}});
addColumnObj
Adds a new column with specified index.
▸ addColumnObj(column: QueryColumn | QueryColumn[],index: any
,author: any
): void
Parameters:
- column: QueryColumn | QueryColumn[] - The column or array of columns
- index:
any
- The index of new column - author:
any
- The author.
Returns void
Example:
const column = new Column();
column.caption = "Company name";
query.addColumn(column, 1)
addConditionGroup
Adds a condition group - a group of simple conditions (predicates) linked by AND or OR
▸ addConditionGroup(descriptor: ConditionGroupDescriptor,addChildCondition?: boolean
): Condition
Parameters:
- descriptor: ConditionGroupDescriptor - The descriptor of the new condition group.
- addChildCondition:
boolean
, Default value =true
Returns Condition - The new search condition.
addDrillDown
▸ addDrillDown(): Query
Returns Query
addExtraConditionGroup
▸ addExtraConditionGroup(descriptor: ConditionGroupDescriptor,addChildCondition?: boolean
): Condition
Parameters:
- descriptor: ConditionGroupDescriptor
- addChildCondition:
boolean
, Default value =true
Returns Condition
addProcessCallback
Add process callback
▸ addProcessCallback(callback: (event: EqEvent
) => void
): string
Parameters:
- callback: (event:
EqEvent
) =>void
- The callback.
Returns string
addSimpleCondition
Adds a new simple condition (a predicate)
▸ addSimpleCondition(descriptor: SimpleConditionDescriptor): Condition
Parameters:
- descriptor: SimpleConditionDescriptor - The descriptor which defines different parameters of the new condition
Returns Condition - The new condition.
addSimpleExtraCondition
▸ addSimpleExtraCondition(descriptor: SimpleConditionDescriptor): Condition
Parameters:
- descriptor: SimpleConditionDescriptor
Returns Condition
changeColumnType
Changes column to Aggregate function, custom expression or simple column.
▸ changeColumnType(column: QueryColumn,tag: ExprTag,args?: any
): void
Parameters:
- column: QueryColumn - The column to change.
- tag: ExprTag - New column expression tag.
- args:
any
, Optional - The arguments (Contains aggregate function id)
Returns void
clear
Clears the query (all conditions, columns, extraData, etc).
▸ clear(): void
Returns void
clearColumns
Clears all columns in query
▸ clearColumns(): void
Returns void
clearConditions
Clears all conditions in query.
▸ clearConditions(): void
Returns void
clearDrillDowns
Clears all drill downs
▸ clearDrillDowns(): void
Returns void
clearExtraConditions
Clears all extra conditions in query
▸ clearExtraConditions(): void
Returns void
createColumn
▸ createColumn(justsorted?: boolean
): QueryColumn
Parameters:
- justsorted:
boolean
, Default value =false
Returns QueryColumn
createCondition
▸ createCondition(tag?: CondTag): Condition
Parameters:
- tag: CondTag, Default value =
CondTag.Simple
Returns Condition
findColumnById
▸ findColumnById(colId: string
): QueryColumn | null
Parameters:
- colId:
string
Returns QueryColumn | null
fireChangedEvent
Fires a QueryChanged event.
▸ fireChangedEvent(params?: QueryChangeEventParams): any
Parameters:
- params: QueryChangeEventParams, Optional - The event parameters.
Returns any
▸ fireChangedEvent(params?: QueryChangeEventParams,postpone?: number
,wasModified?: boolean
): any
Parameters:
- params: QueryChangeEventParams, Optional
- postpone:
number
, Optional - wasModified:
boolean
, Optional
Returns any
fireColumnsChangedEvent
▸ fireColumnsChangedEvent(action?: QueryChangeAction,column?: QueryColumn | QueryColumn[],justsorted?: boolean
): void
Parameters:
- action: QueryChangeAction, Optional
- column: QueryColumn | QueryColumn[], Optional
- justsorted:
boolean
, Default value =false
Returns void
fireConditionsChangedEvent
▸ fireConditionsChangedEvent(action?: QueryChangeAction,condition?: Condition | Condition[]): void
Parameters:
- action: QueryChangeAction, Optional
- condition: Condition | Condition[], Optional
Returns void
fireProcessEvent
Fires process event.
▸ fireProcessEvent(data: any
): void
Parameters:
- data:
any
- The data.
Returns void
getAggregatedColumns
▸ getAggregatedColumns(): QueryColumn[]
Returns QueryColumn[]
getColumnById
▸ getColumnById(id: string
): QueryColumn
Parameters:
- id:
string
Returns QueryColumn
getColumnSortIndex
Gets Colummn sorting index.
▸ getColumnSortIndex(col: QueryColumn): number
Parameters:
- col: QueryColumn - The column.
Returns number
getColumns
Get array of columns.
▸ getColumns(): QueryColumn[]
Returns QueryColumn[]
getConditionsText
Retruns conditions text
▸ getConditionsText(): string
Returns string
getConditionsTextAsHtml
Retruns conditions text
▸ getConditionsTextAsHtml(): string
Returns string
getDescription
Gets description of the query.
▸ getDescription(): string
Returns string
getDrillDowns
▸ getDrillDowns(): Array
<Query>
Returns Array
<Query>
getId
Gets query ID.
▸ getId(): string
Returns string
- The ID>
getJustSortedColumns
Get array of columns used only in sorting.
▸ getJustSortedColumns(): QueryColumn[]
Returns QueryColumn[]
getModel
Gets DataModel object associated with this query.
▸ getModel(): DataModel
Returns DataModel
getName
Gets name of the query.
▸ getName(): string
Returns string
getOneValueForAttr
Gets one value for the attribute
▸ getOneValueForAttr(attrId: string
): string
Parameters:
- attrId:
string
- The attribute ID.
Returns string
getParentQuery
▸ getParentQuery(): Query | null
Returns Query | null
getRootCondition
Gets root predicate
▸ getRootCondition(): Condition
Returns Condition
getSortedColumns
Gets array of columns used in sorting
▸ getSortedColumns(): QueryColumn[]
Returns QueryColumn[]
getUsedInTotalsColumns
Gets array of columns that are used as keys for totals.
▸ getUsedInTotalsColumns(): QueryColumn[]
Returns QueryColumn[]
hasEnabledAggrColumns
▸ hasEnabledAggrColumns(): boolean
Returns boolean
isEmpty
Checks wether query does not contains any column and any condition.
▸ isEmpty(): boolean
Returns boolean
isEmptyColumns
Checks wether query does not contains any column.
▸ isEmptyColumns(): boolean
Returns boolean
isEmptyConditions
Checks wether query does not contains any condtion.
▸ isEmptyConditions(): boolean
Returns boolean
isEx
▸ isEx(): boolean
Returns boolean
isModified
▸ isModified(): boolean
Returns boolean
loadFromData
Loads query from data representation.
▸ loadFromData(data: QueryData,changeStatus?: boolean
): void
Parameters:
- data: QueryData
- changeStatus:
boolean
, Default value =true
Returns void
loadFromDataOrJson
Sets data to the query.
▸ loadFromDataOrJson(data: QueryData | string
,changeStatus?: boolean
): void
Parameters:
- data: QueryData |
string
- JSON representation object or JSON string - changeStatus:
boolean
, Default value =true
- Indicate whether we should change the "isModified" status (by default ==true
)
Returns void
loadFromJson
Loads query from JSON.
▸ loadFromJson(json: string
,changeStatus?: boolean
): void
Parameters:
- json:
string
- The JSON string. - changeStatus:
boolean
, Default value =true
Returns void
loadModelData
Loads data model.
▸ loadModelData(model: ModelPlainData | string
): void
Parameters:
- model: ModelPlainData |
string
- JSON representation object or JSON string.
Returns void
moveColumn
Moves the column with specified index to another position.
▸ moveColumn(index1: number
,index2: number
): void
Parameters:
- index1:
number
- The index of the column that should be moved. - index2:
number
- The index of the position the column should be moved to
Returns void
regenerateId
Regenerates current query ID.
▸ regenerateId(): void
Returns void
removeChangedCallback
Remove changed callback
▸ removeChangedCallback(callbackId: string
): void
Parameters:
- callbackId:
string
- The callback ID.
Returns void
removeColumn
Removes the column.
▸ removeColumn(column: QueryColumn,author: any
): void
Parameters:
- column: QueryColumn - The column to be removed.
- author:
any
- The author
Returns void
removeColumns
Removes several columns passed as array.
▸ removeColumns(columnsToRemove: QueryColumn[],author: any
): void
Parameters:
- columnsToRemove: QueryColumn[] - The list of columns to be removed.
- author:
any
- The author.
Returns void
removeProcessCallback
Remove process callback
▸ removeProcessCallback(callbackId: string
): void
Parameters:
- callbackId:
string
- The callback ID.
Returns void
reset
Resets the query: clears all its conditions and columns, regenerate the ID and sets the default name.
▸ reset(clearQuery?: boolean
): void
Parameters:
- clearQuery:
boolean
, Default value =true
Returns void
resetModified
▸ resetModified(): void
Returns void
runThroughConditions
Runs through condition with this callback.
▸ runThroughConditions(processCondition: (cond: Condition) => void
): void
Parameters:
- processCondition: (cond: Condition) =>
void
- The function to process condition.
Returns void
setDefaultName
▸ setDefaultName(): string
Returns string
setDescription
Sets description of the query
▸ setDescription(description: string
): void
Parameters:
- description:
string
- New description.
Returns void
setId
Sets query ID.
▸ setId(id: string
): void
Parameters:
- id:
string
- New Query ID.
Returns void
setModel
Sets DataModel object associated with this query.
▸ setModel(model: DataModel): void
Parameters:
- model: DataModel - The data model.
Returns void
setName
Sets name of the query
▸ setName(name: string
): void
Parameters:
- name:
string
- New name.
Returns void
toJSON
Returns JSON representation of this query.
▸ toJSON(): string
Returns string
toJSONData
Returns JSON representation of this query.
▸ toJSONData(): QueryData
Returns QueryData
tryValidate
Validates wether the query corresponds to the model.
▸ tryValidate(options?: ValidateQueryOptions): boolean
Parameters:
- options: ValidateQueryOptions, Optional - Validate options.
Returns boolean
- true
if it is valid, otherwise false
validate
Validates wether the query corresponds to the model.
▸ validate(options?: ValidateQueryOptions): void
Parameters:
- options: ValidateQueryOptions, Optional - Validate options.
Returns void
Protected Methods
createSimpleConditionObject
▸ createSimpleConditionObject(attr: EntityAttr,operator: Operator,inputValues: string
| Array
<string
>): Condition
Parameters:
- attr: EntityAttr
- operator: Operator
- inputValues:
string
|Array
<string
>
Returns Condition