Premium support for our pure JavaScript UI components


Post by jandresampaio »

On the state demo, https://bryntum.com/examples/grid/state/ if user restores the state, the previous filter is kept after clearing or typing a new filter value

1) filter a column
2) save state
3) refresh the example
4) restore the state
5) clear existing filter
6) the filter is kept and if user types other filter value it's added to the collection filters currently applied.

Demo attached.

Is there a workaround for this?

Attachments
Bryntum Grid - State demo (1).mp4
(3.79 MiB) Downloaded 53 times

Post by Maxim Gorkovsky »

It see the problem but it is apparently related to the code editor. If you refresh the page properly, enable the filter bar and restore the state - filter gets cleared normally. So in the real application it should not be a problem.
In any case I opened a ticket to investigate this live reload issue: https://github.com/bryntum/support/issues/3778 Thank you for report.


Post by jandresampaio »

It happens on our application when loading a grid and restoring a state so it doesn't seem related to the code editor on your online example...it keeps acumulating filters each time the state is restored.


Post by Maxim Gorkovsky »

It might happen that when we fix this problem related to the code editor it won't change anything in your app. Can you make a runnable test case of that state demo which would reproduce problem without invlolving online code edtior? It should be reproducible if you utilize same approach to reload the grid.


Post by jandresampaio »

not really, in our case we just leave the current route, so grid is destroyed.
Then even after refreshing the page, the grid will accumulate filters after restoring state :/


Post by jandresampaio »

If you refresh the example page:

1) filter a column using the "filter" funnel and type a value
2) apply the following to make the filterBar appear

(function setFilterBar(){ var grid = bryntum.query("grid");  grid.features = { ...grid.features, filter: false, filterBar: true} ; grid.features.filterBar.showFilterBar(); } )()

3) store the state
4) restore the state
5) searching on filter bar no longer produces results


Post by saki »

Yes, it behaves as you describe and it is a bug. I have created the ticket here: https://github.com/bryntum/support/issues/3787


Post by jandresampaio »

Any workaround?


Post by saki »

I think the existing filter could be removed manually from the store and if that is not enough then also from the UI filter field(s). It could be done in "Clear State" handler or before you show the filterBar depending on your use-case.


Post by jandresampaio »

In our app it occurs after state is restored and then user changes the filter values. I suppose it should be right before user changes the text or editor values. Can you point us on how to catch that?


Post Reply