Dialogs keep being added/duplicating in the UI

UI Components for JSF
tonico
Posts: 51
Joined: 22 Aug 2010, 00:15

02 Nov 2010, 21:50

Primefaces 2.2 RC1, Glassfish 3.0.1, NetBeans IDE 6.9 (Build 201006101454)

This will a little too complex to give a test case, so I will try first to report this issue and see if anyone had similarly experience this. This has occurred also on 2.2 M1.

I have a tabView with tabs that are loaded dynamically based on menu selections. On some of the tabs I have a composite button that opens a dialog. The first time I access this dialog clicking the button, all shows fine. As I go through some other tabs and return to the tab where the dialog was first invoked, the dialog opens twice (one overlapping the other). I need to close the front-most dialog so I can trigger the appropriate selection on the underlying one. As I go through other tabs again I keep on seeing more overlapping dialogs progressively, and overall the application keeps on slowing down.

It appeared to me that the additional dialogs HTML gets added to the bottom of the page's html, outside the form. Somehow things are progressively added to the HTML.

Anyone has an idea on how to avoid this ? I have named widgets and ids and that did not help.
Last edited by tonico on 02 Nov 2010, 22:13, edited 1 time in total.
- Tonico
Primefaces 2.2.1 - Glassfish 3.1 - Mac OS X Lion

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

02 Nov 2010, 22:13

I've never seen tha. I know its complex but if you provide a test case which we can reproduce im sure we will find whats going on.
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

derek
Posts: 57
Joined: 24 Aug 2010, 00:56
Location: Canada

02 Nov 2010, 22:19

I have had problems with multiple dialogs opening on top of each other... and its always been related to updating the dialog before opening it...

for example

Code: Select all

            <h:form id="xxx">
              <p:commandButton value="test" update="xxx" oncomplete="yyy.show()"/>
              <p:dialog widgetVar="yyy">
                  <h:outputText value="sfgsdfsdf"/>
              </p:dialog>
            </h:form>
maybe you are doing something similar?
PrimeFaces-3.0, Mojarra 2.0.4, GlassFish 3.1

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

02 Nov 2010, 22:38

I have no problems updating dialogs before openning them, for example if i have dinamic content in a dialog i update an outputPanel inside the dialog and if i have dinamic header in a dialog i update an outputPanel outside the dialog but never update the dialog itself.
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Nov 2010, 23:23

When working with dialog, you never should update the dialog, it will corrupt the dom, result in unexpected behavior. Instead update a container (outputPanel) inside the dialog. Example;

http://www.primefaces.org/showcase/ui/spinner.jsf

tonico
Posts: 51
Joined: 22 Aug 2010, 00:15

03 Nov 2010, 00:23

Following the latest suggestion, I added an outputPanel wrapping teh inner of the dialog, but it did not improve the issue. Prior to that the update was also oriented only to the p:tree component and not the dialog directly. The following is the JSF code. The first part shows a label and an icon that once activated shows the dialog in a lazy-load perspective, as the tree needs to be composed and then the dialog show. I am also having the same issue on a simpler scenario that does not involve a tree nor lazy-loading, but just a dialog and some data.

I will attempt to create a test-case. Thanks for your responses so far.

Code: Select all

        <h:panelGrid columns="2" rendered="#{cc.attrs.render}">
            <h:outputLabel  id="treeNodeLabel" value="#{cc.attrs.value}" converter="#{treeNodeController.converter}" />
            <h:outputLink value="javascript:void(0)" onclick="lazyload();treeDialog.show()">
                <h:graphicImage style="border-width:0px;vertical-align: bottom;" url="/resources/images/icons/tree.png"/>
            </h:outputLink>
        </h:panelGrid>

        <p:dialog id="treeDialog" widgetVar="treeDialog" header="Tree Node Selector" width="600" height="300"
                  closeListener="#{dialogBean.handleClose}"
                  resizable="true" showEffect="clip" hideEffect="clip">
            <p:outputPanel id="treePanel">
                <p:tree id="tree" widgetVar="tree" value="#{treeNodeSelectorBean.root}" var="node"
                        selectionMode="single" selection="#{treeNodeSelectorBean.selectedNode}"
                        nodeSelectListener="#{treeNodeSelectorBean.nodeSelected}" onselectComplete="tree.hide();alignPageArtifacts()"
                        propagateSelectionUp="false"
                        propagateSelectionDown="false"   >
                    <p:treeNode>
                        <h:outputText value="#{node.label}" />
                    </p:treeNode>
                </p:tree>
            </p:outputPanel>
        </p:dialog>

        <p:remoteCommand  name="lazyload" action="#{treeNodeSelectorBean.prepareTree(navigationBean.libraryTreeHeaderId, cc.attrs.recipientProperty)}" update="treePanel" >
        </p:remoteCommand>

        <p:remoteCommand  name="alignPageArtifacts"  update="treeNodeLabel">
        </p:remoteCommand>
- Tonico
Primefaces 2.2.1 - Glassfish 3.1 - Mac OS X Lion

tonico
Posts: 51
Joined: 22 Aug 2010, 00:15

03 Nov 2010, 00:39

Thinking further, I think that Prime's response may indicate the problem I am indeed having. I do actually update not the dialog itself but a parent most component that contains the dialog and other components. In my case I update the tabView that contains all of my tabs that have underlying composites such as the tree dialog in my previous note.

Would this be an issue ? Just to clarify, is it discouraged to update a tab/tabView as it may contain many artifacts ? Are there other components that may have this similar issue such as the dialog ? Sorry for the many related questions, but I want to understand what is "updatable" and what isn't and uderstand its limitations. Thank you.
- Tonico
Primefaces 2.2.1 - Glassfish 3.1 - Mac OS X Lion

Franke
Posts: 49
Joined: 12 Oct 2010, 08:41

04 Nov 2010, 16:52

I have the same issue. I think their point is to never update a dialog directly OR any of the dialogs parents. But updating a dialogs childs are ok. I need my dialog inside the same form that gets updated though, since the button on the dialog is supposed to submit that form.... so I'll have to think of a different solution.
Using PF 3.0 with default JSF implementation of JBoss 6

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Nov 2010, 17:17

Does adding form option to commandButton sounds good, by default commandButton submits it's parent form with or without ajax, imagine this, you can define a form attribute and provide the id of the form to submit. This will be very flexible, just thinking, what is your opinion?

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

04 Nov 2010, 20:06


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests