Events

All w2ui controls have the same event flow. There are two ways you can add/remove events:
  1. using on"Event" properties
  2. using .on() and .off() methods
The first way is simple, can be done during object creation, but limits you to a single event listener per event. The second way lets you add multiple event listeners, but can only be used at run-time. It gives you a better control of the event flow. Every widget property that start with "on" is an event.

Properties and Methods

handlers - array of objects
Array of event handlers.
on - function (type, handler)
Adds event listener to the w2ui object.
off - function (type, [handler])
Removes event listener to the w2ui object.
trigger - function (eventData)
Executes all event listeners added with .on() method.

Event Handler Function

When an event is emitted the handler function will receive one parameter: function(event). This parameter event is an object that contains useful information about the event.
Event handler looks like: By default all event handlers are triggered before the default behavior. You can cancel event default behavior by: You can also define a function that will be executed after the default behavior is processed. For example: You can define several of those functions and all will be executed.

User Comments

comments powered by Disqus