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

destroying a panel when closed

Expand Messages
  • Todd Wells
    I have a situation where I have a panel that displays when an item is clicked, e.g. var outputPanel = new YAHOO.widget.Panel( outPanel , {dragOnly: true,
    Message 1 of 4 , Dec 2, 2008
    • 0 Attachment
      I have a situation where I have a panel that displays when an item is clicked, e.g.

          var outputPanel = new YAHOO.widget.Panel("outPanel", {dragOnly: true, width: "700px",
           visible: true, x: 50, y: 100});
        outputPanel.setHeader("Output");
        outputPanel.setBody("Loading...");
        outputPanel.render("outContainer");

      However, it appears that every time this code is called, it appends an additional "outPanel" to the "outContainer" div, rather than re-using the one that's there. This is excessive memory use, so I guess what I'd like to do is destroy outPanel when the panel is closed.  What's the best way to go about this?
    • Neo He
      why don t you check outputPanel first to see if it s null before render it? From: Todd Wells Sent: Wednesday, December 03, 2008 12:22 To:
      Message 2 of 4 , Dec 2, 2008
      • 0 Attachment
        why don't you check outputPanel first to see if it's null before render it?
         
         

        Sent: Wednesday, December 03, 2008 12:22
        Subject: [ydn-javascript] destroying a panel when closed

        I have a situation where I have a panel that displays when an item is clicked, e.g.

            var outputPanel = new YAHOO.widget. Panel("outPanel", {dragOnly: true, width: "700px",
             visible: true, x: 50, y: 100});
          outputPanel. setHeader("Output");
          outputPanel. setBody("Loading...");
          outputPanel. render("outContainer");

        However, it appears that every time this code is called, it appends an additional "outPanel" to the "outContainer" div, rather than re-using the one that's there. This is excessive memory use, so I guess what I'd like to do is destroy outPanel when the panel is closed.  What's the best way to go about this?

      • Arun Kumar Roy
        better is to write an init function and inside it create the panel and in the click call a show function which will just render the panel
        Message 3 of 4 , Dec 2, 2008
        • 0 Attachment
          better is to write an init function and inside it create the panel and in the click call a show function which will just render the panel

          On Wed, Dec 3, 2008 at 9:52 AM, Todd Wells <ttopwells@...> wrote:

          I have a situation where I have a panel that displays when an item is clicked, e.g.

              var outputPanel = new YAHOO.widget.Panel("outPanel", {dragOnly: true, width: "700px",
               visible: true, x: 50, y: 100});
            outputPanel.setHeader("Output");
            outputPanel.setBody("Loading...");
            outputPanel.render("outContainer");

          However, it appears that every time this code is called, it appends an additional "outPanel" to the "outContainer" div, rather than re-using the one that's there. This is excessive memory use, so I guess what I'd like to do is destroy outPanel when the panel is closed.  What's the best way to go about this?

        • Todd Wells
          Because the variable that references outputPanel is declared locally in a function and the function is potentially called multiple times. I still need to
          Message 4 of 4 , Dec 3, 2008
          • 0 Attachment
            Because the variable that references outputPanel is declared locally in a function and the function is potentially called multiple times.  I still need to render it, but I no longer have a handle to the original object, it just exists as a div inside my container. I'd like it to be destroyed when it is closed originally.

            On Tue, Dec 2, 2008 at 10:15 PM, Neo He <popman_he@...> wrote:
            why don't you check outputPanel first to see if it's null before render it?
             
             

            Sent: Wednesday, December 03, 2008 12:22
            Subject: [ydn-javascript] destroying a panel when closed

            I have a situation where I have a panel that displays when an item is clicked, e.g.

                var outputPanel = new YAHOO.widget.Panel("outPanel", {dragOnly: true, width: "700px",
                 visible: true, x: 50, y: 100});
              outputPanel.setHeader("Output");
              outputPanel.setBody("Loading...");
              outputPanel.render("outContainer");

            However, it appears that every time this code is called, it appends an additional "outPanel" to the "outContainer" div, rather than re-using the one that's there. This is excessive memory use, so I guess what I'd like to do is destroy outPanel when the panel is closed.  What's the best way to go about this?


          Your message has been successfully submitted and would be delivered to recipients shortly.