We currently use combination of events for synchrinization and saving state while filtering to dataFrame to init new viewers from this state.
In native grok we use event ‘d4-filter-criteria-changed’ for notifying other filters and
dataFrame.rows.filterStates
for saving filter’s state.
This array is emptied before each call of onRowsFiltering and filters add their states to it while filtering.
eg.
subs.add(dataFrame.onRowsFiltering.listen((dynamic requester) {
…
filter.beginUpdate();
// filtering
filter.endUpdate(requester: this);
dataFrame.rows.filters.add("${valueColumn.name}: $filterSummary");
dataFrame.rows.filterStates.add(saveState());
then during filter init check dataFrame.rows.filterStates for state with corresponding column.
var state = dataFrame.rows.filterStates.firstWhere((d) => d[‘column’] == filterColumn.name, orElse: () => null);
if you use filter only whithin native grok places (filter panel and property panel) then Datagrok will automatically find and apply state(you still need to save state, check RowList_AddFilterState method).
Otherwise if you use it as viewer in other places you will need to add the code above with finding the saved state. Unfortunately we don’t have api for it right now though we will add it in next version. If you need it right now you can use other place for storing state like dataFrame tag.
Also we will add synchronization for substructure filter in next version as an example.