Reopening composition detail doesn;t load

Until saved, if add a new composite record and go back from the main detail screen for edit, the data is not displayed automatically:

image

Hello,

It’s hard to tell what’s going on. I see different dates in the list and in the detail view for the atten date property. Do you have additional logic that initialises some of the attributes for the new entity?

Thanks,
Ilya

Actually no additional logic behind. It can be dates or it can be any other data types that cause emty selection when I reopen the composite entity before it is saved.

Coud you please provide a test project with the issue?

Thanks,
Ilya

I don’t have a test project but i hope I have clarified the question but let me know if anything is unclear.

To reproduce the issue I need more details.

Are you able to send the entity classes, detail view descriptors and controllers for Attend Log Manual and Attend Log Manual Line?
What version of jmix are you using?

Thanks,
Ilya

Hi IIia
Please find attached the requested files

attendLogManual_files.txt (42.2 KB)

Hi,

Thanks for the files.

I see this code in the AttendLogManualLineDetailView:

@Subscribe
    public void onReady(ReadyEvent event) {
        if(entityStates.isNew(getEditedEntity())){
            getEditedEntity().setPostedToAttendLog(false);
            getEditedEntity().setUpdateCheckInTime(true);
            getEditedEntity().setUpdateCheckOutTime(true);
            getEditedEntity().setCheckInBufferMinute(0);
            getEditedEntity().setCheckOutBufferMinute(0);
            getEditedEntity().setAttenDate(LocalDate.now());
        }
    }

Because the entity hasn’t been committed, it has the status ‘new’. And the controller sets defaults every time the detail view is opened. Try to change this logic to set defaults when attenDate is null, or something else that suits your workflow.

Thanks,
Ilya

1 Like

Thank you llya