Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-11736

rich:popupPanel x domElementAttachment="parent"

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.Final
    • Fix Version/s: 4.3.7
    • Labels:
      None
    • Environment:

      NetBeans 7.0.0 + GlassFish 3.1.1 + JSF2 + CDI + RF4 + Hibernate3

    • Steps to Reproduce:
      Hide

      http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataTable&sample=dataTableEdit&skin=blueSky => click first time, look at panel centered, close it, then click second time

      Show
      http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataTable&sample=dataTableEdit&skin=blueSky => click first time, look at panel centered, close it, then click second time
    • Workaround Description:
      Hide

      Workaround from: https://community.jboss.org/message/727796#727796

      I included a jquery function which will center an element to the screen.

      jQuery.fn.center = function () {
          this.css("position","absolute");
          this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
          this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
          return this;
      }
      

      Taken from http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen

      I then put the following javascript into my buttons oncomplete attribute RichFaces.$('myForm:myPopup').getContentElement().center()

      Using your button I would then make it

      <a4j:commandButton id="buttonPanel" value="Open"
         render="openGrid"
         action="#{t.openPanel}"
         oncomplete="#{rich:component('openPanel')}.show(); RichFaces.$('formCad:openPanel').getContentElement().center()"/>
      

      I tried putting the call into the popPanels onbeforeshow event attribute but I failed to get it to work there. Hope this works for you. If anyone finds a cleaner or better way please post it.

      Show
      Workaround from: https://community.jboss.org/message/727796#727796 I included a jquery function which will center an element to the screen. jQuery.fn.center = function () { this.css("position","absolute"); this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px"); this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px"); return this; } Taken from http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen I then put the following javascript into my buttons oncomplete attribute RichFaces.$('myForm:myPopup').getContentElement().center() Using your button I would then make it <a4j:commandButton id="buttonPanel" value="Open" render="openGrid" action="#{t.openPanel}" oncomplete="#{rich:component('openPanel')}.show(); RichFaces.$('formCad:openPanel').getContentElement().center()"/> I tried putting the call into the popPanels onbeforeshow event attribute but I failed to get it to work there. Hope this works for you. If anyone finds a cleaner or better way please post it.
    • Estimated Difficulty:
      Low
    • Bugzilla Update:
      Perform

      Description

      rich:popupPanel repositions after second click when we use domElementAttachment="parent"

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  michpetrov Michal Petrov
                  Reporter:
                  edilmar Edilmar Alves
                • Votes:
                  4 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: