Dilemma with nested collections


I have a dilemma with the way I should treat nested collections in a StandardEditor. I will explain a single case but this problem arises almost everywhere in my application, so I would like to find a complete solution.

I have 2 entities, Persona (person) and Direccion(address):

  • I want to edit the entity Persona, and its Direccion(es) nested collection property in a single transaction, and let the Direccion editor open in a Dialog window. The Direccion instances are displayed in a regular Table, with create, edit and remove actions.

My first approach was to handle it throug the regular table actions, but then I have no control on the display mode (new tab, dialog) nor the transaction (set a parentContext for the edition of the Direccion entity). So the Direccion instance is stored in the database before the Persona instance is saved, which is not a desired behavior.

After that, I tried to invoke directly (and overriding any table default action) the Direccion editor launch, by invoking directly and manually a new EditorBuilder where I would launch the editorscreen, enabling setting the Dialog mode, and setting the parentDataContext in order to ensure that Direccion would be only stored in the database if the Persona editor saved changes. This works fine but then I need to manually add the Direccion instance to the Direccion CollectionPropertyContainer of the Persona instance for it to be displayed in the Direccion table when the Direccion editor closes, via a ScreenCloseEvent.

I have the feeling I am doing something wrong, and doing things the platform would do automatically if promptly arranged. I am missing something important and don’t know what it is.

Another strange behavior is that if I use the second approach using propertycontainers instead of instancecontainers (through their collection version) the attribute .Persona in the Direccion instance is not stored in the database. This seems to be to the fact that the DataContext of the screen stores a version of the Direccion instance where it’s .persona attribute is null. So I don’t know exactly where to set the .Persona attribute in the Direccion instance to ensure it is stored correctly in the database.

I have much more to specify for you to understand the weird behavior but I wouldn’t like you to get bored with this post.

Many thanks for any insights.


Ok now I saw the xml descriptor, and saw through the dialogMode xml descriptor I can force the screen to be open as dialog. Ok that issue solved and tested. The problem with the dataContext persists.



by @susbscribin an event in the actions included in the tables, I call the entitybuilder, and including the .withListComponent() call I solve all the pending issues. By adding this call in the EditorBuilder call, I don’t need anymore the AfterClose event. So all looks much clearer and neater now.

For anyone it may help.