Problem opening view for self-referencing entity

I have problem opening detail view if view i am opening is same as my current view.

Example:

my current view is PropertyDetailView and i want to open self-rererenced parent also in PropertyDetailView:

viewNavigators.detailView(this, Property.class)
                    .editEntity(parent)
                    .withBackwardNavigation(true)
                    .navigate();

after triggering the method URL is changed accordingly but i stay on current view.

My current fix is calling closeWithDefaultAction(); before viewNavigators.detailView(… but this is not really what i want to achieve.

Hello,

Exactly, this will happens because the navigation just pushes user to the path. Same view has same url path.

Probably instead of pushing user, can you open new dialog for your business case? check dialogWindows

Best regards,
Dmitry

Hi Dmitry,

sure, i am aware of dialogWindows but, this app should be really well optimized for mobile and dialogWindows kinda sucks on mobile :smiley:

but i also dont really like the behaviour of method with: closeWithDefaultAction();

I have come up with another possible solution:
maybee i can create Extension of my current dialogWindow and i will be cycling beween extended and original view for navigation purposes, but this seems kinda ugly.

In cuba platform there was no issue with this type of navigation in self referencing entities.

@d.cherkasov i was not clear on what the problem is. While editing existing entity this way it is okay and works. Creating new entity on the other hand will get you just same window. (You can not crate new entity, this way) Screen will stay stucked on previous entity.

viewNavigators.detailView(this, Property.class)
                    .newEntity()
                    .withQueryParameters(QueryParameters.simple(queryParams))
                    .withBackwardNavigation(true)
                    .navigate();

Hello,
I can’t suggest you something really working, because this is how Jmix CRUD works.

But i can suggest work-around - you extend same view but not to use Detail view, also override path for view:

  • for new entity: /property/new/{uuid-for-new-entity-optional} or /property/new/
  • for new entity: /property/{existing-entity}

Instead of /property/{id=new} & /property/{id=existing-uuid}

Best regards,
Dmitry