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.

Index

Constructors

Public Properties

Public Methods

Constructors


constructor

⊕ new EqContext(): EqContext


Public Properties


clientListRequestHandler

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


dataModel

● dataModel: DataModel


defaultModelId

● defaultModelId?: string


defaultQueryId

● defaultQueryId?: string


initialQuery

● initialQuery?: QueryData


loadModelOnStart

● loadModelOnStart: boolean = true


loadQueryOnStart

● loadQueryOnStart: boolean = false


onError

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


onInit

● onInit?: () => void


onInitialModelLoad

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


onLoadModel

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


onLoadQuery

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


onProcessEnd

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


onProcessStart

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


paging

● paging: EqPagingOptions


query

● query: Query


resultContent

● resultContent?: string


resultSet

● resultSet?: EqDataTable


resultStatement

● resultStatement?: string


useBootstrap

● useBootstrap: boolean = false


Public Methods


addLocale

Adds the translations of the EasyQuery messages for some locale

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

Parameters:

  • 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


addQueryChangedCallback

Register a new handler for "query changed" event

▸ addQueryChangedCallback(callback: any): void

Parameters:

  • callback: any -

Returns void


addWidget

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

▸ addWidget(widget: Widget): void

Parameters:

Returns void


clearQuery

Clears the content of the current query

▸ clearQuery(): void

Returns void


clearResult

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

▸ clearResult(): void

Returns void


endProcess

Notifies all context components about the finishing of some long process

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

Parameters:

Returns void


getBroker

Gets the current broker component

▸ getBroker(): EqBroker

Returns EqBroker


getListRequestHandler

Gets the handler for "GetList" requests

▸ getListRequestHandler(): any

Returns any


getModel

Gets the current data model

▸ getModel(): DataModel

Returns DataModel


getQuery

Gets the current query

▸ getQuery(): Query

Returns Query


init

Initializes the context

▸ init(options?: EqContextOptions): void

Parameters:

Returns void


loadDefaultModel

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

▸ loadDefaultModel(): void

Returns void


refreshWidgets

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

▸ refreshWidgets(groups?: WidgetGroup): void

Parameters:

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

Returns void


removeQueryChangedCallback

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

▸ removeQueryChangedCallback(callback: any): void

Parameters:

  • callback: any -

Returns void


resetListCache

Clears the current list cache.

▸ resetListCache(): void

Returns void


setDefaultModelId

Sets the ID of the default model

▸ setDefaultModelId(modelId: string): void

Parameters:

  • modelId: string -

Returns void


setExternalListCache

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

▸ setExternalListCache(cache: ExternalListCache): void

Parameters:

Returns void


setModel

Sets the content of the current data model

▸ setModel(dataModel: DataModelData): void

Parameters:

Returns void


startProcess

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

Parameters:

Returns void


throwError

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

Parameters:

Returns void