1.5 KiB
1.5 KiB
layout, title, recline-deps, root
| layout | title | recline-deps | root |
|---|---|---|---|
| container | Tutorial - Dataset Basics - Events | true | ../ |
Dataset Basics - Events
Preparations
See first Dataset basics tutorial for getting setup and initializing Dataset.
Listening for Events
Often you'll want to listen to events on a Dataset and its associated objects. This is easy to do thanks to the use of Backbone model objects which have a standard set of events.
Here's an example to illustrate:
{% highlight javascript %} {% include tutorial-basics-ex-events.js %} {% endhighlight %}
Here's a summary of the main objects and their events:
-
Dataset:
- Standard Backbone events for changes to attributes (note that this will not include changes to records)
- query:start / query:end called at start and completion of a query
-
Dataset.records: Backbone.Collection of "current" records (i.e. those resulting from latest query) with standard Backbone set of events: add, reset, remove
-
Dataset.queryState: queryState is a Query object with standard Backbone Model set of events
-
Dataset.fields: Backbone Collection of Fields.