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

RE: [ydn-javascript] Re: YUI Panel - To capture the panel close(X) event.

Expand Messages
  • Satyen Desai
    Hi, Does the beforeHideEvent not allow you to do what you need to? (it currently won t let you stop the panel from being hidden - is that what you re trying to
    Message 1 of 6 , Nov 30, 2007
      Hi,
      Does the beforeHideEvent not allow you to do what you need to?

      (it currently won't let you stop the panel from being hidden - is that
      what you're trying to achieve?)

      http://developer.yahoo.com/yui/docs/YAHOO.widget.Module.html#beforeHideE
      vent

      beforeHideEvent is the recommended approach. You can attach a click
      listener to the close icon itself, but you'll still need to deal with
      the default click listener which is attached, which will be invoked
      before yours.

      var panel = new YAHOO.widget.Panel("container");

      panel.beforeHideEvent.subscribe(function() {
      alert("Before Hide");
      });
      panel.render();

      var closeEl = YAHOO.util.Dom.getElementsByClassName(
      "container-close", null, panel.element)[0];

      YAHOO.util.Event.on(closeEl, "click", function(){
      alert("Click Added via DOM");
      });

      Regards,
      Satyen
    • mtorres253
      Thanks! That did the trick Michael
      Message 2 of 6 , Nov 30, 2007
        Thanks! That did the trick

        Michael
        --- In ydn-javascript@yahoogroups.com, "Satyen Desai" <sdesai@...> wrote:
        >
        > Hi,
        > Does the beforeHideEvent not allow you to do what you need to?
        >
        > (it currently won't let you stop the panel from being hidden - is that
        > what you're trying to achieve?)
        >
        > http://developer.yahoo.com/yui/docs/YAHOO.widget.Module.html#beforeHideE
        > vent
        >
        > beforeHideEvent is the recommended approach. You can attach a click
        > listener to the close icon itself, but you'll still need to deal with
        > the default click listener which is attached, which will be invoked
        > before yours.
        >
        > var panel = new YAHOO.widget.Panel("container");
        >
        > panel.beforeHideEvent.subscribe(function() {
        > alert("Before Hide");
        > });
        > panel.render();
        >
        > var closeEl = YAHOO.util.Dom.getElementsByClassName(
        > "container-close", null, panel.element)[0];
        >
        > YAHOO.util.Event.on(closeEl, "click", function(){
        > alert("Click Added via DOM");
        > });
        >
        > Regards,
        > Satyen
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.