Events

Previous Next

To make sure events on a control are triggered in the right order, an abstraction layer has been build. In some situations this layer essential for the proper behavior of the application. For example, if a button is added to each row of a grid, it is essential that clicking the button first changes the current row before firing the actual click event of the button.

Besides that the layer also takes care of the following issues:

Making sure that the right context is used (see Web Architecture document).

Redirecting certain events to the udb layer

Serving as entry point for benchmark to be able to record tests

To access this layer, call the .setEvents() function. This function returns nothing. Its syntax is:

.setEvents( event-objectevents, options )

 

options  :=  {

     match:  match

,    exclude:  exclude

,    dsId:  alternative-data-source

,    selector:  selector

,    benchmark:  benchmark

}

The required event-object is a JQuery object (the value of event-object starts with a '$' symbol) that references the event object. The required events is an object that contains a list of events and their handlers.

The optional options is a struct that can have the following items, all of which are optional.

Match is a regular expression that specifies the subset of events to bind. The default is /.*/

Exclude is a regular expression that specifies the events to be excluded from binding. The default is /^$/

dsId is a string indicating an alternative data source ID.

Selector is a string pointing to a descendant of $e binding it as an delegate.

Benchmark is a boolean indicating whether the events are relevant for benchmarking. The default is true.

 

Example

this.setEvents($el, this.events, {match: /change/});