Conceptual - 'Global' Dialog Across Multiple Views

UI Components for JSF
Post Reply
realcam_de
Posts: 5
Joined: 08 Aug 2018, 16:52

10 Aug 2018, 13:03

Hello All,

I have a conceptual question and I'm still very much a beginner with JSF and PF.

We have an app that has a main menu consisting of ever present buttons with each menu button opening a different view for a certain functionality within the app. Each view has their own backing bean and each view is an independent sub application if you like with its own backend calls etc. Each view could exist without any of the others.

One of the views - lets call it ViewA - is a little different from the others in that it has to offer parametrized navigation to some of the other views, ViewB, ViewC and ViewD.

ViewA holds a list with items in a datatable and has the ability to view each item's detail in a pop-up dialog.
The requirement is that in this pop-up dialog there must be navigation buttons depending on the make up of the item detail. And with these buttons the user may navigate to ViewB and even pre-populate a field or two in ViewB's form elements with the dialog's item detail.
Haven't done that before but it sounds standard enough and I'll probably get that done one way or the other.

There is one aspect of the requirements for ViewA's popup dialog I am struggling with though.

When the user navigates to ViewB the pop-up dialog is supposed to stay open and on top. The user must be able to do stuff in the newly opened ViewB and then have the ability to copy&paste data between the dialog and elements in the newly opened ViewB.
Then when the user's work is done the user may chose to close the dialog and remain in ViewB or directly return to ViewA where the pop-up dialog was shown from originally.

So I need some sort of global always on top (but not modal) dialog that I can control from all the different views and can exchange data with.
But I have no idea how to do that.

I started out with a p:dialog I defined in ViewA's xhtml. But of course it disappears once I navigate away from ViewA. I understand the dialog is a child of this view.
So I tried moving the p:dialog to a part of my screen that always lives, like the panel with the main menu buttons. But it doesn't seem to make a difference the dialog still disappears when navigating away from the view that show()ed the dialog originally.

Do I have to open a new browser window for this? Or do I need to use the dialog framework instead of p:dialog? Is my thinking even right that the main obstacle is that the dialog is a child of ViewA?

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

10 Aug 2018, 23:50

I am not sure i even quite understand the UI paradigm you are trying to use with a non-modal dialog staying on the screen while you swap View A and View B out behind it?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Aug 2018, 11:22

Me neither, it is very unusual an a dialog sort of obstructing the ui (without being modal) is not common practice. Minimizing the dialog is an option but to have it stay open it must be outside the viewA (e.g. define it in a 'footer' Or be both in viewA AND viewB opening automatically 'onload'. Still it is an uncommon usecase

realcam_de
Posts: 5
Joined: 08 Aug 2018, 16:52

14 Aug 2018, 17:47

Hello,

first of all thanks for reading and commenting.
And yes, I agree, it is an unusual use case, but it is not my use case. I am just the guy supposed to implement it. :o

However, after getting to the bottom of the use case ('what is it we're trying to achieve here?') I have mitigated the problem.
The user was supposed to take an element's data from viewA (via viewA's pop-up) to viewB. Basically display the item detail in the pop-up, navigate over to viewB with the pop-up still open, then be able to copy & paste data between pop-up and viewB.

I now navigate to viewB from the pop-up and pre-populate viewB with the item details using navigation parameters. Achieves the same thing and it seems I no longer need to keep the dialog open.

Thanks again

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

15 Aug 2018, 13:19

Awesome. Sometimes I always take a step back and ask the requirements person "what is it we are trying to achieve here?" because sometimes they show up with designs on how they want something to work instead of just describing the problem they are trying to solve!
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests