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

[ydn-javascript] Creating dynamic containers

Expand Messages
  • m_nhk
    I want to be able to instantiate multiple panels dynamically, the examples in YUI create the panels by hard coding when instantiating the Panels, thus:
    Message 1 of 4 , Oct 9, 2009
    • 0 Attachment
      I want to be able to instantiate multiple panels dynamically, the examples in
      YUI create the panels by hard coding when instantiating the Panels, thus:

      YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1" ...
      YAHOO.example.container.panel2 = new YAHOO.widget.Panel("panel2" ...
      YAHOO.example.container.panel3 = new YAHOO.widget.Panel("panel3" ...

      I would be able to name the Panels dynamically by creating a global counter
      function and do something like

      {
      counter++;
      return "panel"+counter;
      }

      but I don't see how I can dynamically create the variable to reference:

      YAHOO.example.container.panel1

      any help on this would be great, I basically want to create a 1..n popups
      thx

      --
      View this message in context: http://www.nabble.com/Creating-dynamic-containers-tp25823496p25823496.html
      Sent from the ydn-javascript mailing list archive at Nabble.com.
    • Martin Kamerbeek
      ... Why don t you just use an array to contain your panels? Use counter as the index. Martin
      Message 2 of 4 , Oct 10, 2009
      • 0 Attachment
        m_nhk wrote:
        > but I don't see how I can dynamically create the variable to reference:
        >
        > YAHOO.example.container.panel1
        >
        Why don't you just use an array to contain your panels? Use counter as
        the index.

        Martin
      • m_nhk
        thank you martin, simple but exactly what i needed to hear, cheers! ... -- View this message in context:
        Message 3 of 4 , Oct 11, 2009
        • 0 Attachment
          thank you martin, simple but exactly what i needed to hear, cheers!



          m_nhk wrote:
          >
          > I want to be able to instantiate multiple panels dynamically, the examples
          > in YUI create the panels by hard coding when instantiating the Panels,
          > thus:
          >
          > YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1" ...
          > YAHOO.example.container.panel2 = new YAHOO.widget.Panel("panel2" ...
          > YAHOO.example.container.panel3 = new YAHOO.widget.Panel("panel3" ...
          >
          > I would be able to name the Panels dynamically by creating a global
          > counter function and do something like
          >
          > {
          > counter++;
          > return "panel"+counter;
          > }
          >
          > but I don't see how I can dynamically create the variable to reference:
          >
          > YAHOO.example.container.panel1
          >
          > any help on this would be great, I basically want to create a 1..n popups
          > thx
          >
          >

          --
          View this message in context: http://www.nabble.com/Creating-dynamic-containers-tp25823496p25843028.html
          Sent from the ydn-javascript mailing list archive at Nabble.com.
        • m_nhk
          thank you martin, simple but exactly what i needed to hear, cheers! -- View this message in context:
          Message 4 of 4 , Oct 11, 2009
          • 0 Attachment
            thank you martin, simple but exactly what i needed to hear, cheers!

            --
            View this message in context: http://www.nabble.com/Creating-dynamic-containers-tp25823496p25843028.html
            Sent from the ydn-javascript mailing list archive at Nabble.com.
          Your message has been successfully submitted and would be delivered to recipients shortly.