convertFilterChangedToUpdateFiltersPayload(filterChangedPayload: FilterChangedPayload ) : UpdateFiltersPayload
Converts the payload emitted by EmbedEvent.FilterChanged into the payload shape expected by HostEvent.UpdateFilters, so the same filter state can be captured and re-applied later, for example on a subsequent page load.
Both the Liveboard filters and the runtime filters present in the
FilterChanged payload are included in the returned filters array.
Note: a column with multiple date-filter conditions (e.g. an OR of two
date ranges) is not guaranteed to round-trip losslessly - HostEvent.UpdateFilters
treats date filters as replace-not-merge per column, so only the last
converted entry for such a column will apply.
Function Parameters
- filterChangedPayload
-
-
filterChangedPayload: FilterChangedPayload
-
The filter state carried by the
EmbedEvent.FilterChanged callback, which is payload.data - the
callback argument is the event envelope, and the filters sit under its
data key.
Returns
let savedFilters;
liveboardEmbed.on(EmbedEvent.FilterChanged, (payload) => {
savedFilters = convertFilterChangedToUpdateFiltersPayload(payload.data);
});
// later, e.g. after a fresh page load
liveboardEmbed.trigger(HostEvent.UpdateFilters, savedFilters);
Defined in : utils/filterConverter.ts