Use case or problem
I would like to be able to style a row in a Base using CSS based it’s row number. There are several use cases for this:
- Show a row number for each row.
- Style even/odd rows differently (ex striped rows).
Proposed solution
Add a “row number” attribute to Base rows.
Right now the HTML for a row in a table view in a base looks something like this:
<div class="bases-tr" style="top: 0px; width: 903px;">
I would like to propose that an attribute, such as data-index or data-row-number, is added to the HTML so it can be targeted using CSS.
<div data-index="1" class="bases-tr" style="top: 0px; width: 903px;">
Current workaround (optional)
There is no workaround for showing a row number for each row, because rows are dynamically added/removed from the DOM for performance reasons, you cannot show the actual row number, only the row number that is currently visible on the screen, which is not accurate.
For striped rows, you can use a repeating gradient that matches the row height to achieve the same effect, see this comment for an example.