3 Replies Latest reply on Dec 22, 2006 11:09 AM by ntsiii

    Changing the text in each dataGrid row to a different color

    xyco45 Level 1
      Okay I am going to try and be as clear as possible with this, so bare with me.

      What I am trying to do is make it so that when my arraycollection objects that I have retrieved from a web service are loaded in (by using the "dataProvider" attribute) my dataGrid that some sort of code will take place changing the color of each line of text (all the objects stored in the array collection are string types) and display each rows text in a different color.

      Now after looking into it, it seems the only way to alter the color of the text is to use some sort of style or format but it seems it only effects text in a "textArea, textField, textInput" etc... SOOO I figured why not create a itemRenderer that contains one of those and put it into the dataGrid... Which I did and still can't figure out a way to make it so you can dynamically alter the color based on a set of rbg values stored in a array the same size as the rowCount of the datagrid.

      so I am rather stumpped in what to do.. I DON'T want to change the background color of each row, so alternatingItemColor is out of the question, I just want the text displayed in each row to be a different color.... And I want all this color changing to happen either before the data is inputted into the dataGrid (manipulating the arraycollection some how..) or when its all already in there, it all needs to happen in code no user interaction.

      I was thinking perhaps maybe I could create a item Renderer object that contains the compenent (the textArea in it) and just make a array of item Renderer objects and pass those into the dataGrid, but I don't think that is possible.

      ANY IDEAS AT ALL!! On how to change the color of the text in each row of the datagrid to a different color would be a HUGE, HUGE!!! help. Or any info on how to setup a datagrid listener that listens for when a object (a row) from the arraycollection is added to the datagrid... Perhaps I could use that info some how to my advantage.

      email me, if you like I don't care I just need a answer to this its driving me crazy! I can change the background row color based on a array of rgb values but I can't change the color of the item in that row based on array of rgb values, ARG!

      thanx in advanced.