Skip to content

EqContext class

Encapsulates all information about EasyQuery components on some webpage. Each context includes the following main components:

  • one data model,
  • one query,
  • one result set
  • one broker
  • several UI widgets.

⊕ new EqContext(): EqContext



● clientListRequestHandler: (data: any, callback: (list: any) => void) => boolean


● dataModel: DataModel


● defaultModelId?: string


● defaultQueryId?: string


● initialQuery?: QueryData


● loadModelOnStart: boolean = true


● loadQueryOnStart: boolean = false


● onError?: (message: ErrorMessage) => void


● onInit?: () => void


● onInitialModelLoad?: (model: DataModel) => void


● onLoadModel?: (model: DataModel) => void


● onLoadQuery?: (query: Query) => void


● onProcessEnd?: (message: Message) => void


● onProcessStart?: (message: Message) => void


● paging: EqPagingOptions


● query: Query


● resultContent?: string


● resultSet?: EqDataTable


● resultStatement?: string


● useBootstrap: boolean = false



Adds the translations of the EasyQuery messages for some locale

▸ addLocale(locale: string,localeTexts: any): void

  • locale: string - the ISO code of the locale (like en or uk)
  • localeTexts: any - The translations of EasyQuery texts and messages. We expected an object with the struture of TextResources class here.

Returns void


Register a new handler for “query changed” event

▸ addQueryChangedCallback(callback: any): void

  • callback: any -

Returns void


Add a new widget to the context. After that the widget will start to receive messages from other context components.

▸ addWidget(widget: Widget): void

Returns void


Clears the content of the current query

▸ clearQuery(): void

Returns void


Clears all query results (the data set and the statement, if any)

▸ clearResult(): void

Returns void


Notifies all context components about the finishing of some long process

▸ endProcess(message: Message,groups?: WidgetGroup): void

Returns void


Gets the current broker component

▸ getBroker(): EqBroker

Returns EqBroker


Gets the handler for “GetList” requests

▸ getListRequestHandler(): any

Returns any


Gets the current data model

▸ getModel(): DataModel

Returns DataModel


Gets the current query

▸ getQuery(): Query

Returns Query


Initializes the context

▸ init(options?: EqContextOptions): void

Returns void


If defaultModelId property is define - this method calls loadModel function in the broker to load the model with such ID.

▸ loadDefaultModel(): void

Returns void


This method is called automatically when some change was made either in context’s data model or query

▸ refreshWidgets(groups?: WidgetGroup): void

  • groups: WidgetGroup, Default value = WidgetGroup.All -

Returns void


Removes the function from the list of registerd handlers for “query changed” event

▸ removeQueryChangedCallback(callback: any): void

  • callback: any -

Returns void


Clears the current list cache.

▸ resetListCache(): void

Returns void


Sets the ID of the default model

▸ setDefaultModelId(modelId: string): void

  • modelId: string -

Returns void


Sets the external “list cache” provider - an object which implements ExpternalListCache inteface

▸ setExternalListCache(cache: ExternalListCache): void

Returns void


Sets the content of the current data model

▸ setModel(dataModel: DataModelData): void

Returns void


Notifies context components about starting of some long process (e.g. model loading) This method raises onProcessStart event in the context and all its widgets

▸ startProcess(message: Message,groups?: WidgetGroup): void

Returns void


Throws the error passed in the function parameter. If onError event handler is defined - we call that method. Otherwise - just place the error message to the browser console.

▸ throwError(error: ErrorMessage): void

Returns void