Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Observation: Alternate row color changes in custom style
Observation: Alternate row color changes in custom style [message #1746648] Wed, 02 November 2016 13:37 Go to next message
Naveen Sabapathy is currently offline Naveen SabapathyFriend
Messages: 46
Registered: July 2016
Member
When we apply the custom style to a table, then while scrolling the table changes the ODD and EVEN table row color.

Take the example Classic Examples -> Styling -> Custom styling of Specific cells.

Scroll the nattable one row at a time, and inspect the ODD/EVEN numbered row colors.
it changes again and again.
Is it a desired behaviour or its a bug?

If its a bug then we do the following changes in ColumnOverrideLabelAccumulator, then it works fine.
		if(rowPosition%2==0)
			configLabels.addLabel("EVEN_BODY");
		else
			configLabels.addLabel("ODD_BODY");

Re: Observation: Alternate row color changes in custom style [message #1746664 is a reply to message #1746648] Wed, 02 November 2016 15:44 Go to previous message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Quote:
Is it a desired behaviour or its a bug?


It is neither a desired behavior nor is it a bug. It is a wrong configuration on your side that also exists in some of the NatTable examples (so no blame, just a hint).

The issue is hidden in the creation of the AlternatingRowConfigLabelAccumulator. If you create it with a layer it is able to translate the row position to the row index. If you follow one of our examples that creates the GridLayer yourself and sets the layers afterwards, the DefaultGridLayerConfiguration will initialize the AlternatingRowConfigLabelAccumulator with null as parameter, which leads to the usage of the row position. And that changes on scrolling which leads to the changing background colors.

If you set the body layer stack yourself to the GridLayer AFTER the GridLayer is initialized, you need to set the config label accumulator for the alternating rows again with the correct body layer reference.

setConfigLabelAccumulatorForRegion(
                    GridRegion.BODY,
                    new AlternatingRowConfigLabelAccumulator(bodyLayer));
Previous Topic:second lvl RowGroup Example
Next Topic:Facing issue while rename column header in Nattable
Goto Forum:
  


Current Time: Wed Sep 19 12:27:29 GMT 2018

Powered by FUDForum. Page generated in 0.02041 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top