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

Updating body (displayed content) of a LayoutUnit

Expand Messages
  • jt2190
    I have a LayoutUnit with a top, left, and center. I want to click on a widget in the center, and then change the contents displayed in that center LayoutUnit.
    Message 1 of 3 , Apr 26, 2008
    • 0 Attachment
      I have a LayoutUnit with a top, left, and center.

      I want to click on a widget in the center, and then change the contents displayed in that center LayoutUnit.

      So far, the only way I've been able to make this work is by setting the LayoutUnit's body to a string:

      YAHOO.util.LayoutUnit.set("body", "<p>A string of HTML</p>");


      However, I'm not able to change the body by referring to an element.
      For example, neither of the following work:

      YAHOO.util.LayoutUnit.body = YAHOO.util.Dom.get("elementId");
      YAHOO.util.LayoutUnit.body = "elementId";


      Is three a method of "reconfiguring" a LayoutUnit so that it uses
      another element or element id? If not, what is the correct approach to
      changing the display through a LayoutUnit?


      James
    • Dav Glass
      James -- You should be able to do this: //For the code below var layout = new YAHOO.widget.Layout(/* Config */); //Get the element reference var el =
      Message 2 of 3 , Apr 26, 2008
      • 0 Attachment
        James --

        You should be able to do this:

        //For the code below
        var layout = new YAHOO.widget.Layout(/*  Config */);

        //Get the element reference
        var el = YAHOO.util.Dom.get('elementId');
        //Get a reference to the center units Object
        var center = layout.getUnitByPosition('center');
        //Clear out the current body
        center.set('body', '');
        //Set the new body with the element reference from above
        center.set('body', el);

        Does that help?
        Dav
         
        Dav Glass
        dav.glass@...
        blog.davglass.com



        + Windows: n. - The most successful computer virus, ever. +
        + A computer without a Microsoft operating system is like a dog
        without bricks tied to its head +
        + A Microsoft Certified Systems Engineer is to computing what a
        McDonalds Certified Food Specialist is to fine cuisine +


        ----- Original Message ----
        From: jt2190 <james@...>
        To: ydn-javascript@yahoogroups.com
        Sent: Saturday, April 26, 2008 3:08:18 PM
        Subject: [ydn-javascript] Updating body (displayed content) of a LayoutUnit

        I have a LayoutUnit with a top, left, and center.

        I want to click on a widget in the center, and then change the contents displayed in that center LayoutUnit.

        So far, the only way I've been able to make this work is by setting the LayoutUnit's body to a string:

        YAHOO.util.LayoutUnit.set("body", "<p>A string of HTML</p>");


        However, I'm not able to change the body by referring to an element.
        For example, neither of the following work:

        YAHOO.util.LayoutUnit.body = YAHOO.util.Dom.get("elementId");
        YAHOO.util.LayoutUnit.body = "elementId";


        Is three a method of "reconfiguring" a LayoutUnit so that it uses
        another element or element id? If not, what is the correct approach to
        changing the display through a LayoutUnit?


        James
      • jt2190
        Hi Dav, That did indeed work. Thank you very much! James ... LayoutUnit ... contents displayed in that center LayoutUnit.
        Message 3 of 3 , Apr 30, 2008
        • 0 Attachment
          Hi Dav,

          That did indeed work. Thank you very much!

          James



          --- In ydn-javascript@yahoogroups.com, Dav Glass <dav.glass@...> wrote:
          >
          > James --
          >
          > You should be able to do this:
          >
          > //For the code below
          > var layout = new YAHOO.widget.Layout(/* Config */);
          >
          > //Get the element reference
          > var el = YAHOO.util.Dom.get('elementId');
          > //Get a reference to the center units Object
          > var center = layout.getUnitByPosition('center');
          > //Clear out the current body
          > center.set('body', '');
          > //Set the new body with the element reference from above
          > center.set('body', el);
          >
          > Does that help?
          > Dav
          >
          > Dav Glass
          > dav.glass@...
          > blog.davglass.com
          >
          >
          >
          >
          > + Windows: n. - The most successful computer virus, ever. +
          > + A computer without a Microsoft operating system is like a dog
          > without bricks tied to its head +
          > + A Microsoft Certified Systems Engineer is to computing what a
          > McDonalds Certified Food Specialist is to fine cuisine +
          >
          >
          >
          > ----- Original Message ----
          > From: jt2190 <james@...>
          > To: ydn-javascript@yahoogroups.com
          > Sent: Saturday, April 26, 2008 3:08:18 PM
          > Subject: [ydn-javascript] Updating body (displayed content) of a
          LayoutUnit
          >
          > I have a LayoutUnit with a top, left, and center.
          >
          > I want to click on a widget in the center, and then change the
          contents displayed in that center LayoutUnit.
          >
          > So far, the only way I've been able to make this work is by setting
          the LayoutUnit's body to a string:
          >
          > YAHOO.util.LayoutUnit.set("body", "<p>A string of HTML</p>");
          >
          > However, I'm not able to change the body by referring to an element.
          > For example, neither of the following work:
          >
          > YAHOO.util.LayoutUnit.body = YAHOO.util.Dom.get("elementId");
          > YAHOO.util.LayoutUnit.body = "elementId";
          >
          > Is three a method of "reconfiguring" a LayoutUnit so that it uses
          > another element or element id? If not, what is the correct approach to
          > changing the display through a LayoutUnit?
          >
          >
          > James
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.