2 Replies Latest reply on Jun 13, 2011 8:38 AM by archemedia

    Flex 3 Datagrid problem

    archemedia Level 4

      Hello all,

       

      After a frustrated afternoon, I'll try my luck on this forum...

       

      I have a simple DataGrid (or List) which displays text. I define a itemRenderer like this:

       

                     <mx:itemRenderer>
                          <mx:Component>
                                  <mx:Text width="100%" text="{data.description}" selectable="false" fontSize="12"/>
                          </mx:Component>
                      </mx:itemRenderer>

       

      Works fine, no problem.

       

      Now, I want to color the background of this text. To do this, I wrap the text component in a Canvas (or VBox):

       

                     <mx:itemRenderer>
                          <mx:Component>
                              <mx:Canvas width="100%" height="100%" backgroundColor="{Config.COLOR_DARK_GREEN}">

                                  <mx:Text width="100%" text="{data.description}" selectable="false" fontSize="12"/>
                              </mx:Canvas>
                          </mx:Component>
                      </mx:itemRenderer>

       

       

      ...but when I do that, measuring of the datagrid row heights isn't correct anymore!

       

      What am I doing wrong??

       

      The results are shown here:

       

      Schermafbeelding 2011-06-13 om 16.49.33.png

      Thx in advance,

       

      Dany