Models
have several different events available for you to listen to, as shown in the following table:
Event name |
Trigger |
---|---|
| |
| |
| |
| |
| |
| |
|
When validation triggered by a Model's |
There are also several other events that are related to Collection, which will be explained further in the next chapter:
Event name |
Trigger |
---|---|
| |
| |
|
Models also have one other, special, event called all
. This event is triggered in response when any of the other Model
events are triggered.
Although you are unlikely to use them very often, you may find it useful to create your own custom events on certain occasions. This can be done by using the Model's trigger
method, which lets you simulate an event coming from the Model
, as follows:
someModel.trigger('fakeEvent', 5);
You can listen for these events in the way same as any other non-custom event, by using the on
method. Any additional arguments passed to trigger
(such as the 5
in the preceding example) will be passed as arguments to event handlers that listen for that event.
3.145.105.105