|Best way to apply dynamic styling in 1.1 [message #1401503]
||Tue, 15 July 2014 18:12
| Evan O\'Connell
Registered: August 2013
To summarize, I need to apply a particular style to cell based on its data value at runtime.|
For example, displaying negative numbers in red and positive in black.
The approach I took in 1.0 was to inspect the IDataLayer from a ColumnLabelAccumulator -- not the most performant solution but it worked. After upgrading to 1.1, I am experiencing a StackOverflowException. It turns out the new features added to the GroupByDataLayer require the #getDataValueByPosition method to invoke the ColumnLabelAcumulator. Thus, my solution creates an endless loop.
It looks like there are two examples releated to this: _001_Custom_styling_of_specific_cells and _002_Using_a_custom_cell_painter
- 001's solution uses a ColumnLabelAccumulator but assumes knoweledge of the cell's position ahead of time.
- 002's solution uses CellPainters to dynamically change the cell's background based on the cell's value.
Using 002 as an example, I created a new CellPainterWrapper that adds a "negative_number" label to the LabelStack if the cell's value is less than zero.
Would you recommend doing it this way?
[Updated on: Tue, 15 July 2014 18:30]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.06994 seconds