1 Reply Latest reply on Jan 21, 2009 5:45 AM by Newsgroup_User

    Datagrid column width

    flex2008 Level 3
      I have a datagrid in a canvas.
      1.Each column should be wide enough to fit the header or the largest possible content in that particular column,whichever of the two is largest.
      2.If the width of datagrid exceeds the canvas there should be horizontal scrollbars available to view the complete contents
      3.If the width of datagrid is less than canvas the datagrid should stretch itself in the canvas.

      can u please help me out in this.?
        • 1. Re: Datagrid column width
          Level 7

          "flex2008" <webforumsuser@macromedia.com> wrote in message
          news:gl6ht6$mf8$1@forums.macromedia.com...
          >I have a datagrid in a canvas.
          > 1.Each column should be wide enough to fit the header or the largest
          > possible
          > content in that particular column,whichever of the two is largest.

          To do this, you would need to look through your data and find the largest
          entry, then make a copy of your itemRenderer, measure it, and set the column
          width from there.

          > 2.If the width of datagrid exceeds the canvas there should be horizontal
          > scrollbars available to view the complete contents

          This is the default behavior of Canvas.

          > 3.If the width of datagrid is less than canvas the datagrid should stretch
          > itself in the canvas.

          You can have this by measuring the DataGrid once it is laid out, and if it
          is less than the width of Canvas, set its percentWidth to 100.