3 Replies Latest reply on Feb 8, 2008 12:15 PM by cxf02

    advanced datagrid row labels

      I have just installed Flex 3 in the hope that I can get row labels for my datagrid.
      I have searched about and found that I need to use labelfunction (or freeze a column?) or something...

      All I want is a table that looks like this:
      | | L | L | L |
      | L | d | d | d |
      | L | d | d | d |
      Where 'L' is a label and 'd' is data.

      please enlighten
        • 1. Re: advanced datagrid row labels
          cxf02 Level 1
          You can use custom renderer's in each row/column intersection. Take a look at this example: http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom- item-renderer/

          • 2. Re: advanced datagrid row labels
            edzillion Level 1
            Don't really understand you. Could you be more verbose please?

            Just to clarify, what I want is all the items in the first DataGridColumn to look/act like the column header along the top. Could you use an itemRenderer to do this? I had a look into the DataGridColumn source to see if I could find where the column header formatting is defined but couldn't find anything...

            <disclaimer> I am a beginner :-)

            • 3. advanced datagrid row labels
              cxf02 Level 1
              Sorry, I really didn't have the time to get into it. This link is to an example with code that does exactly what you are looking for. You really don't need a custom item renderer to do what you want to do, but you may want to do so if you want to provide some functionality that is dependent on the data values.

              The example shows rows of data within an XML object (which could be retrieved from an HTTP service) and each row has the first column value from the name attribute. I'm assuming that you could have 1 to ...n rows and that each row would require a label in the first column. It would be a matter of providing each row with the label you wanted to display as in the example.

              The PriceLabel.as class is customized to render the values red or black dependent on a positive or negative number. It is then used as the value for the attribute itemRenderer ( itemRenderer="PriceLabel" ). FLEX finds this class and uses it as the cell object for that column. The inherited method updateDisplayList is invoked and each item ( or cell) within that column evaluates the value that is set and renders the number accordingly.