Query class

Represents Query.

Index

Constructors

Public Properties

Public Methods

Constructors


constructor

The default constructor. ⊕ new Query(model?: DataModel,data?: QueryData,options?: QueryOptions): Query

Parameters:


Public Properties


attrClassName

The attributec class name (Tag).

● attrClassName: ExprTag


clientListRequestHandler

● clientListRequestHandler: any


model

The Data Model associated with this query.

● model: DataModel


serverListRequestHandler

● serverListRequestHandler: any


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 index.

▸ addColumn(column: Column | Column[],index: any,author: any): void

Parameters:

  • column: Column | Column[] - 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)


addPredicate

Adds a new predicate.

▸ addPredicate(params: any): Condition

Parameters:

  • params: any - The options.

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.

▸ addSimpleCondition(params: any): Condition

Parameters:

  • params: any - The options.

Returns Condition


beginUpdate

Begin update. Set event emitter to silent mode.

▸ beginUpdate(): void

Returns void


clear

Clears query (all conditions and columns).

▸ clear(silent?: boolean): void

Parameters:

  • silent: boolean, Default value = false - Indicate wether clear query without firing event.

Returns void


clearColumns

Clears all columns in query

▸ clearColumns(): void

Returns void


clearConditions

Clears all conditions in query.

▸ clearConditions(): void

Returns void


endUpdate

Begin update. Remove silent mode.

▸ endUpdate(raiseChangeEvent?: boolean): void

Parameters:

  • raiseChangeEvent: boolean, Default value = false

Returns void


fireChangedEvent

Fires change event.

▸ fireChangedEvent(data: any,postpone?: number): void

Parameters:

  • data: any - The data.
  • postpone: number, Default value = 100 - The postpone.

Returns void


fireProcessEvent

Fires process event.

▸ fireProcessEvent(data: any): void

Parameters:

  • data: any - The data.

Returns void


getColumnSortIndex

Gets Colummn sorting index.

▸ getColumnSortIndex(col: Column): number

Parameters:

Returns number


getColumns

Get array of columns.

▸ getColumns(): Column[]

Returns Column[]


getConditionsText

Retruns conditions text

▸ getConditionsText(): string

Returns string


getDescription

Gets description of the query.

▸ getDescription(): string

Returns string


getId

Gets query ID.

▸ getId(): string

Returns string - The ID>


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


getRootPredicate

Gets root predicate

▸ getRootPredicate(): Condition

Returns Condition


getSortedColumns

Gets array of columns used in sorting

▸ getSortedColumns(): Column[]

Returns Column[]


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


loadFromJson

Loads query from JSON.

▸ loadFromJson(json: string): void

Parameters:

  • json: string - The JSON string.

Returns void


loadModelData

Loads data model.

▸ loadModelData(model: DataModelData | string): void

Parameters:

  • model: DataModelData | string - JSON representation object or JSON string.

Returns void


moveColumn

Moves the column with specified index to another position.

▸ moveColumn(index1: number,index2: number,author: any): 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
  • author: any - The author

Returns void


removeChangedCallback

Remove changed callback

▸ removeChangedCallback(callbackId: string): void

Parameters:

  • callbackId: string - The callback ID.

Returns void


removeColumn

Removes the column.

▸ removeColumn(column: Column,author: any): void

Parameters:

  • column: Column - The column to be removed.
  • author: any - The author

Returns void


removeColumns

Removes several columns passed as array.

▸ removeColumns(columnsToRemove: Column[],author: any): void

Parameters:

  • columnsToRemove: Column[] - 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


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


setData

Sets data to the query.

▸ setData(data: QueryData | string,silent?: boolean): void

Parameters:

  • data: QueryData | string - JSON representation object or JSON string
  • silent: boolean, Default value = false - Indicate wether to set data silent (without firing event)

Returns void


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:

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