Hello all,
Currently, it is not easy to identify displayed values in Live Data.
For instance, it is not safe to base the selector:
- on the nth-element as they can be reordered
- on the element type (e.g.,
td
) as we support several layouts (table and cards for now)
I propose to annotate each displayer with the identifier of the property it is displaying.
Option 1: class
This is the option proposed in the currently opened PR XWIKI-21935: Annotate Live Data entries with a class corresponding to the entry id by manuelleduc · Pull Request #2930 · xwiki/xwiki-platform · GitHub
Each displayer has a new class with the same value as the property id in addition to the existing livedata-displayer
<td data-title="File size" class="cell">
<div class="livedata-displayer filesize"><!-- The filesize class correspond to the property id of the cell-->
<div data-tippy-component-trigger="" tabindex="0">
<div class="view">
<div>
<div class="html-wrapper"> <span class="size" data-size="44816">43.8 KB</span></div>
</div>
</div>
</div>
</div>
</td>
Option 2: data
The same logic, but instead of a class, we add a new data-livedata-property-id='propertyId'
on the displayer root
<td data-title="File size" class="cell">
<div class="livedata-displayer" data-livedata-property-id='filesize'><!-- The filesize class correspond to the property id of the cell-->
<div data-tippy-component-trigger="" tabindex="0">
<div class="view">
<div>
<div class="html-wrapper"> <span class="size" data-size="44816">43.8 KB</span></div>
</div>
</div>
</div>
</div>
</td>
Conclusion
Both options are equally usable from CSS/Javascript.
Here is my +1 for option 1 as it’s more concise, but I’m also +0 for option 2.
WDYT?