update related entity in browser screen

hi CUBA team,

I am trying to update a related entity in a browser screen.

At first, I tried to use a nested dataSource to commit the change, but it didn’t work for me.

then I tried to use the dataManager to commit the updated related entity, the related entity is updated, but I met another problem when I was closing the browser screen, I got a message “Do you want to discard unsaved changes?”

I think my solution maybe not correct.

can you please give me some advice.

Thank you very much.

Gabriel.

Hi Gabriel,

If you commit some entities programmatically and don’t want this message about unsaved changes, clear the “Allow commit” checkbox for your datasource. It corresponds to allowCommit=“false” attribute in XML. Then the datasource will not be checked for unsaved changes.

Hi Konstantin,

Actually, I just wanted to update a related entity, but not the one I selected, is there a better way to do that if I don’t set allowCommit to false?

Gabriel

It’s hard to recommend anything based on your explanations. Could you create a sample project?

Hi Konstantin,

I found the problem, I made a mistake, I used dataManager to commit the related entity, but I still got a nested dataSource, I when I close the browser, I alway get that message. I have removed the nested dataSource, now it is working fine.

Thank you very much.
Gabriel