Jump to content


Photo

Row color to group data


  • Please log in to reply
2 replies to this topic

#1 damgog

damgog
  • Members
  • 33 posts

Posted 04 October 2013 - 02:09 PM

Hi,

I am trying to have a row color the same as the previous row when the data in a particular column of that row matches the data in the same column of the previous row.

Each row contains a column Set that contains an integer value. I want the row color to be the same for each row until the value of Set changes. I have been trying to do this using the OnCellColoring event without much success. My data generally contains pairs of rows but there is also the possibility that there can be 3/4/5 rows that are grouped together by Set value. I tried to reference the value of the cell in the previous row but this does not work as expected.

Any ideas?

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 06 October 2013 - 05:53 AM

Hi,

Maybe you can attach a TColor value to ObjectReference property of Cell? Or, you can set Color property of Cell to desired value. This way it will not be a virtual, but you will have more control.

Another idea is to use Data property of Row (Row[x]). This is a pointer and you may create a dynamic variable (or a reference) which will be a group index. Even group index will be in one color, odd will be in second color.

I hope that I helped a little bit.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 damgog

damgog
  • Members
  • 33 posts

Posted 08 October 2013 - 02:04 PM

I managed to get this sorted by waiting for the grid to be populated and then looping through and coloring the rows. I implemented the row coloring outside the OnCellColoring event.

Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users