It seems to me that using data-group-id in CSS is not practical, especially since it is dynamically changed and the conditions for owning the element are hidden or not changed. You get a huge piece of CSS that is impossible to maintain.
In the initial rendering, it would be better to add className so that you determine how server- className initial state will be shown.
<tr data-group-id="1" role="data" class="hidden"> <td>Another row belonging to group 1</td> </tr>
I assume that JavaScript is used to dynamically change data-group-id , so why not use JavaScript to add / remove className βhiddenβ className when / where it makes sense. At least in JavaScript you can use regular expressions;)
When you get to the point where you need to write an impossible, long, error-dependent and unreachable CSS expression, you are doing something wrong.
You will need to write some code to achieve this anyway, it can also do it in a clean way, and not try to teach it a style language that is not suitable for this work.
source share