Jump to content
We've recently updated our Privacy Statement, available here ×

Alternating row colors, resetting at group


tgreanier

Recommended Posts

I know I saw this discussed on the forum, but I cannot find it no matter how I search, so I will ask again.

 

I have no problem alternating row colors, but I cannot seem to figure out how to make sure each group starts with the same color (white) instead of whatever the "next" color should be (white or gray). Anyone know how I can reset to the beginning when the group changes?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Yes, I tried that earlier, but I think the problem is one of scope. I am using a conditionExpression for a style, and I do not know which group is currently being processed (this is a dynamic reporting engine). Perhaps I can move the logic for the alternating row to each group instead of at the style level?
Link to comment
Share on other sites

Your report design mechanism seems slightly peculiar (the style doesn't know the name of the group, although they are part of the same report), so I'm not sure what to suggest you.

 

You can move the alternate row logic to the detail band itself by duplicating all the elements and using "print when" expressions based on the group count variable to switch between the two sets of elements (but maybe the detail band doesn't know either the group name).

 

Or you could implement a scriptlet that resets the value of a predefined report variable in beforeGroupInit(), and increases the value in beforeDetailEval(). Then you would the same variable in the conditional style.

 

Or you could have a predefined report parameter that always contains the current JasperReport instance, and use it to determine the group name and to dynamically evaluate the group count variable.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...