Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel54
classcontents

Filter Object

...

let filter = filters.getFilter('Average Age at Camp');
filter.setValueTwo(35, true); //Set valueTwo and apply it
console.log(filter.appliedValueOne); //Outputs '35' 


appliedValueTwo

Returns

String or Number.

Description

...

let eventListenerId = filters.addEventListener('changed', function(event) {
    console.log('One of my filters changed');
    filters.removeEventListener(eventListenerId);
});



trigger(eventName, eventData)

Returns

Nothing.

Description

...

filter.addEventListener('changed', function(event) {
      console.log(event.uuid); //The filters UUID that the event was triggered from
      console.log(event.filter);//The FilterObject that the event was triggered from
});


changed

Description

Occurs when any of the filter values changes. Triggers with an object that contains the values that changed as well as the previous values of all of those values.

Parameters

Event - Object

Contains:

  • uuid - String - UUID of the filter that triggered the event.
  • filter - FilterObject - FilterObject of the filter that triggered the event.
  • changed - Object - Object containing any values that have changed. Could possibly contain valueOne, valueTwo or valueList.
  • Previous - Object - Object containing the old values of all of the changed values. Could possibly contain valueOne, valueTwo or valueList.
Example

filter.addEventListener('applied', function(event) {
      console.log(event.filter.name + " has just been applied with the following changed values " + JSON.stringify(event.changed));
});


applied

Description

Occurs when the filter is applied to the linked piece of content (report/dashboard). And the applied values change.

Parameters

Event - Object

Contains:

  • uuid - String - UUID of the filter that triggered the event.
  • filter - FilterObject - FilterObject of the filter that triggered the event.
  • changed - Object - Object containing any values that have changed. Could possibly contain valueOne, valueTwo or valueList.
  • Previous - Object - Object containing the old values of all of the changed values. Could possibly contain valueOne, valueTwo or valueList.
Example 

filter.addEventListener('applied', function(event) {
      console.log(event.filter.name + " has just been applied with the following changed values " + JSON.stringify(event.changed));
});

Notes/Limitations

The applied event may be triggered in a case like this:

let filter = filters.getFilter('Demographic');
filter.setValue(['Adventure']);
filter.apply();

filter.setValue(['Adventure']);
filter.apply();

Due to the code creating a new Array when calling setValue. So any comparison that occurs will be of Array to Array.

The correct values will still be applied to the report.


reset

Description

Occurs when the reset function is called on the filter. This can occur from user interaction, clicking the reset button on a filter menu, or by a developer explicitly calling it. 

Example 

filter.addEventListener('reset', function(event) {
      console.log(event.filter.name + " has just been reset");
});

Parameters

Event - Object

Contains:

  • uuid - String - UUID of the filter that triggered the event.
  • filter - FilterObject - FilterObject of the filter that triggered the event.



cleared

Description

Occurs when the clear function is called on the filter. This can occur from user interaction, or by a developer explicitly calling it. 

Difference between cleared and reset

Resetting a filter resets it to its default values. Where as clearing a filter will set it to have no values. 

Parameters

Event - Object

Contains:

  • uuid - String - UUID of the filter that triggered the event.
  • filter - FilterObject - FilterObject of the filter that triggered the event.
Example 

filter.addEventListener(cleared, function(event) {
      console.log(event.filter.name + " has just had its values cleared");
});