6 Replies Latest reply on Dec 23, 2009 11:50 PM by Shongrunden

    ItemRender height - defaults to about 100

    cartman1138

      Hi,

      I am trying to make an item renderer that will have a border. So I based it on Border and implemented DataRenderer. When it renders the height is 113. I don't set an explicit height because it needs to be able to grow based on what is in it. Shouldn't the border collapse down to the size of it's contents? Any thoughts? The code is below.

       

      Thanks,

       

      John

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Border xmlns:fx="http://ns.adobe.com/mxml/2009" implements="mx.core.IDataRenderer"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/halo"
          borderColor="#FF0000" width="100%" minHeight="20">
          <fx:Metadata>
              [Event(name="dataChange", type="mx.events.FlexEvent")]
          </fx:Metadata>
          <fx:Script>
          <![CDATA[
              import com.lhl.fx.ordering.domain.MenuItem;
              import com.lhl.fx.ordering.util.FormattingUtils;
             
              import mx.core.IDataRenderer;
              import mx.events.FlexEvent;
             
              private var _data:Object;
             
              [Bindable("dataChange")]
              public function get data() : Object {
                  return _data;
              }
             
              public function set data(value : Object) : void {
                  _data = value;
                 
                  dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
              }
          ]]>
          </fx:Script>
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <s:RichText x="2" y="2" width="150" text="{ data.name }" fontWeight="bold"/>
          <s:RichText right="2" y="2" width="40" height="15" text="{ data.price }" textAlign="right" fontWeight="bold"/>
      </s:Border>