2 Replies Latest reply on Sep 15, 2014 9:49 AM by jonleyo

    Close popup if exists without knowing id

    jonleyo

      Hi,

       

      I would like to close a popup without knowing its id.

      I mean, I would like to use a Jquery selector that will give me all the popup and call hide() on it.

       

      ExtendedPartialViewContext ctx = (ExtendedPartialViewContext) FacesContext.getCurrentInstance()
        .getPartialViewContext();
      ctx.prependOnbeforedomupdate("???.hide()");
      

       

      Thanks... if anyone has a solution!

        • 1. Re: Close popup if exists without knowing id
          michpetrov

          If you need to close them in response to a rerender why not just set @show to false?

           

          There is no central stack of popups, if you were doing it through JavaScript you would have to check every element on the page. That's not a good way of doing it unless you can put all your popups into a dedicated space, i.e.

           

          <div id="popups">
              <rich:popupPanel id="popup" … />
              <rich:popupPanel id="anotherPopup" … />
              …
          </div>
          

          On the other hand, why do you expect not to know the ids?

          1 of 1 people found this helpful
          • 2. Re: Close popup if exists without knowing id
            jonleyo

            I have a custom error handler.

            So in a generic way, I don't know which components are in the page.

            And, I don't want to check the view root...