[MGNLUI-3584] Ability to dynamically style cells and rows in tree and list views Created: 14/Sep/15  Updated: 08/Mar/21  Resolved: 08/Mar/21

Status: Closed
Project: Magnolia UI
Component/s: workbench
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Neutral
Reporter: Magnolia International Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: next, ux
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File ColStyle.java     Text File MGNLUI-3584.v2.patch     Text File MGNLUI-3874.v1.patch     Java Source File RowStyle.java    
Issue Links:
Relates
relates to MGNLUI-3813 Configure alignment and style names f... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Date of First Response:

 Description   

If one wants to style a cell or a complete row of a tree or list, the possibilities are limited to using a ColumnFormatter and wrap the data in a <span>. This works to a certain extent, but is not elegant. Styling an entire row (e.g grey it out based on the status of the node) is only doable using nasty javascript tricks.

With the attached patch, we would allow developers to configure CellStyleGenerator at table/list level (to be used for styling rows) and at column level (to style cells).
AggregateCellStyleGenerator is provided so that we can simply pile up the configured generators with our default ones. Presumably, parts of this patch would be moved to info.magnolia.ui.workbench.list.ListPresenter#start, similarly to how we setup the column formatters.



 Comments   
Comment by Magnolia International [ 14/Sep/15 ]

In this second version of the patch, we have configurability, but it shows a two-sided problem: StyleGenerators are a tad "complex" to write, and without lots of conditional statements, they unintuitively get applied to more rows or columns than necessary.

Additionally, Vaadin seems to prefix the returned styles string with v-table-cell-content- or v-table-row-, which I also find counter intuitive. (especially since we potentially want to add several styles, and vaadin only prefixes the first (i.e it doesnt "parse" the returned space-separated string before prefixing))

Comment by Roman Kovařík [ 08/Mar/21 ]

In the new framework it's possible to set styleGenerator on grid. 

No plan to expose this via config.

Generated at Mon Feb 12 09:08:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.