Refresh entity editor screen after a global event is received

Hi Everyone,

I have a scenario where i would like refresh/reload the screen after a global event is received.
My entity has fields which has composition relation and i would like to refresh all the data fields and tables.
Could you please help me how can i achieve a refresh view of the current entity.

Thanks in advance for your help.

Hi,
In global event handler method,i reload data using this approach:

@EventListener
public void onProjectStatDataUpdatedEvent(ProjectStatDataUpdatedEvent event) {        
    dataLoader.load();
}

In my entity editor screen , how do i retrieve instance loader?
Below is my instance declaration in XML:

<instance id=“submissionDc”
    class=“com.company.rioc.entity.Submission”
    view=“submission-view”>
    
    <loader/>

You can get your container with the following code:

InstanceContainer ic = getScreenData().getContainer("submissionDc");

Regards,
Daniil

I am able to get Instance Container. I tried setting the reloaded item from datamanager using setitem API but i dont see view getting refresh.

Could you share a code snippet or demo project to demonstrate how you’re trying to do it?

I’ve checked the case and it seems that everything works.

Please find my submission entity editor xml and java file.test.zip (4.1 KB)
I would like to refresh the screen in the eventlistener of UINotificationevent(onUiNotificationEvent).

You can retrieve the loader if you give it id in the XML and then inject into controller.

As per the documentation(Data Loaders - CUBA Platform. Developer’s Manual) instance loader requires an entity identifier which is specified programmatically by the StandardEditor base class.
For an entity editor screen how can i set the query and the identifier in the XML?

Query can be specified as usual:

<data>
    <instance ...>
        <loader>
            <query>
            ...
             </query>
        </loader>
    </instance>
</data>

To set entity id you should use the following method:

StandardEditor#setEntityToEdit(T item)