Loading ...
Sorry, an error occurred while loading the content.

Re: prompt before panel/dialog closes

Expand Messages
  • twocupcoffee
    I just wanted to post a followup. I found a solution to this issue, but I don t think there s currently a way to achieve this through the apis or the events.
    Message 1 of 2 , Feb 1, 2008
    • 0 Attachment
      I just wanted to post a followup.
      I found a solution to this issue, but I don't think there's currently
      a way to achieve this through the apis or the events.
      This is because of the way the panel's hide function behaves.

      All the panel's hide function does in the code is simply
      "this.cfg.setProperty("visible", false);"
      and waits for the configVisible handler to deal with it.
      and all it does is
      1. fire beforeHideEvent
      2. set panel's div's "display" to "none"
      3. fire hideEvent
      This means that beforeHideEvent and hideEvent are almost purely for
      people to attach listeners to.

      Now, my workaround =). Please don't cringe when you here this. What I
      did was overwrote the my particular panel's hide function at the time
      of init with my own handling etc.

      var myPanel = new YAHOO.widget.Panel etc........
      myPanel.hide = function() {
      if(confirm("Are you sure?")){
      myPanel.cfg.setProperty("visible", false);
      }
      }
      This may be painful for some to see...but its allowed and it's a
      relatively clean workaround.

      Hopefully this helps others that are looking to do this.

      - Andrew Kou



      --- In ydn-javascript@yahoogroups.com, "twocupcoffee"
      <twocupcoffee@...> wrote:
      >
      > Hi, I saw the thread on the beforeHideEvent for the panel and I able
      > to perform actions before the panel actually closes. However, I cannot
      > find a way stop the panel from closing (prompt user that they are
      > closing the panel). Does anyone have an idea of how to do this?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.