datatable filter resets each time underlying datastore is updated

When datatable is connected to datastore and have filter applied the filter resets each time underlying datastore is updated. The effect is that filter cancels and unfiltered datastore content is displayed in datatable.

I did not managed to find any event on datatable that is fired when datastore is updated to reinstall filter as well any any other solution.

Please suggest how to keep datatable filtered after datastore updates.

My case:

Here is the same problem with different widget:


  • Hello, @pokotilenko

    Resetting filtering is the default behavior of the component, it happens because:
    1. sync updates data in related components
    2. the result of filtering through the API (filter / filterByAll) is not stored as the state of the table and may be out of date on updated data.

    To solve the issue, you could set a custom property by which it would be possible to track the filtering status of the table and, if necessary, filter it again.
    When a created datastore or collection is assigned to a component in data, we are dealing with synchronization. From the inside, this type of sync works exactly the same as the explicit sync described in the Documentation
    When you pass the store/collection as data, you can use the onSyncApply event, which will signal the moment to apply some custom method.
    Please, check the snippet here:
    The second way is constantly to apply some kind of data processing in the associated component - to use the sync callback method, as described here

  • Hi.

    Thanks, the solution with "data->onSyncApply" event solves the problem.

    Regarding the docs, it doesn't seem obvious that "onSyncApply" of datastore can be used as "data->onSyncApply" on datatable.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!