Flagging a record as dirty in the UI

In our application we were previously appending an ‘*’ to the caption of the current screen to flag the record as dirty for the user. It appears as though an update to the platform has since made this approach impossible as you can now only set the caption during the initialization of the screen.

I was wondering if anyone has any best practice suggestions on how to solve the issue of flagging a screen as dirty, preferably in the tab so it is visible while looking at other tabs.

Any ideas are welcome. Thank you,
Corey Amoruso

1 Like

Hi,

Could you please clarify what version of CUBA Platform do you use?

Using the latest version I able to change screen caption at runtime, for example, the code below works for me:

@Inject
private Datasource<Product> productDs;

@Override
public void init(Map<String, Object> params) {
    productDs.addItemPropertyChangeListener(e -> {
        if (!PersistenceHelper.isNew(getItem())) {
            setCaption("Test");
        }
    });
}

Gleb,

We are currently on Cuba Version 6.7.8 but will soon be rolling over to the latest 6.8 release.

I duplicated your sample within our application and the setCaption() call from within the listener does not appear to have any effect on the record. Calling setCaption() alone in the init method without placing it in the listener does work but again this does not accomplish what we are looking for.

If you are seeing this work in 6.8 I will test this again once we’ve updated to the latest platform version.

Thank you for your response,

Corey Amoruso

Hi,

I tried to reproduce your problem using platform v6.7.8 and I’ve failed. My code snippet still works. If you attach a sample project where the problem is reproduced I will be able to investigate the problem.

Regards,
Gleb