Automatic refresh of data in a filterModule?

35 views Asked by At

The case that I have to deal with is :

An entity CustomerOrder with a list of TransportOrder.

A filterModule for each entity to be able to browse CustomerOrders and separatly to browse all TransportOrders of all CustomerOrders.

Depending on an action set on CustomerOrder, I generate multiple TransportOrders and update the CustomerOrder's status from "Forecasted" to "Validated". Through the TransportOrder filterModule, the new TransportOrders are displayed.

A second action on CustomerOrder allows to get back the CustomerOrder to its initial status (ie "Forecasted") and consequently remove and delete the relevant TransportOrders.

The issue :

When a CustomerOrder is restored to its initial status, its former TransportOrders (that have been deleted) are always present in the TransportOrder filterModule (the filterModule's data are not automatically refreshed)

Is there a way to automatically refresh the data displayed in the TranportOrder filterModule ?

1

There are 1 answers

0
Vincent Vandenschrick On BEST ANSWER

There is no automatic "cleaning" of module objects after a committed deletion of entities.

However you could easily chain an action after the one that reverts your CustomerOrder status in order to iterate through all your modules and remove the deleted entities if any from the modules moduleObjects collection (or do whatever you want with the module).

Implementing an automatic cleaning would not be that hard, but it would require hooking into the backend controller in order to be notified of any committed transaction, iterate through deleted entities and perform what I've described before. Of course, feel free to issue an enhancement request in GitHub for it.