Skip to content
rondale-sc edited this page Apr 11, 2012 · 2 revisions

Get the data

// From here on I'll be using the data from the spec for all examples

// before filters have been run pivot.data().raw will contain the raw data
// and pivot.data().all will be empty []
pivot.data().all
//=> []

pivot.data().raw
//=> [Object, Object, Object, Object, Object, Object]

Apply a filter

pivot.data().all()
//=> []

pivot.filters().set({last_name: 'Jackson'});
pivot.filters().apply();
//=> [Object, Object, Object]

As you can see once the filter was applied the fields were filtered accordingly. Only objects with last_name of 'Jackson' remain in pivot.data().all

Append filter to existing filters

// Set pre-existing filters
pivot.filters().set({last_name: 'Jackson'});
pivot.filters().apply();
//=> [Object, Object, Object]

// Further restrict the data
pivot.filters().add({first_name: 'Jon'});
//=> [Object]
Clone this wiki locally