0 Replies Latest reply on Dec 4, 2009 5:54 AM by CHAVALASD

    Urgent!! Custom LinkButton (Used as itemRenderer for datagrid) text wrap issue

    CHAVALASD

      Hi,

       

      I have a custom component MultiLineLinkButton which extends LinkButton. I am using this custom component as an itemrenderer for a column in datagrid.

       

      When i try to resize this column in the datagrid the text is not getting wrapped. I have variableRowHeight on my datagrid for wrapping other normal columns which works fine.

      I also tried setting the height by getting the instance of MultiLineLinkButton on columnStretch of datagrid which did not work.

       

      Could you please suggest me how I can wrap the text in this custom component and in general for any other itemrenderers in a datagrid.

       

      Hope i will get a solution soon,

       

      Thanks

       

      Code

      =========

       

      public

       

      class MultiLineLinkButton extends LinkButton

      {

      [

      Bindable]

       

      public var buttonWidth:int = 88;

       

       

      public function MultiLineLinkButton()

      {

       

      super();

      }

       

      override protected function createChildren():void {

       

      trace("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!MultiLineLinkButton-createChildren!!!!!!!!!!!!!!!!!");

       

      super.createChildren();

       

      if (textField){

      textField.wordWrap =

      true;

      textField.multiline =

      true;

      }

      }

       

       

      override public function measureText(s:String):TextLineMetrics {

       

      trace("@@@@@@@@@@@@@@@@@@@@@@@!MultiLineLinkButton-measureText@@@@@@@@@@@@@@@@@@@@@@@@@@@ = "+s);

      textField.text = s;

       

      //textField.width = buttonWidth;

       

      var lineMetrics:TextLineMetrics = textField.getLineMetrics(0);

      lineMetrics.width = textField.textWidth;

      lineMetrics.height = textField.textHeight;

       

      return lineMetrics;

      }

       

      }