The CSS grid layout described here shows that the cells of the grid are added to the markup without any hierarchy, and the layouting into rows and columns is controlled by the CSS directives (grid-template-columns for instance).
An example for creating a 4 columns x 2 rows grid would be:
<div style='display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;'>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
I'm having difficulty using this concept together with a template language, where an iterator is iterating over records, and each iteration creates a row container with the individual elements. The grid lays out the row container instead of its children.
Using a Vue template as an example, the above could be dynamically rendered as follows:
<div style='display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;'>
<div v-for='item in items>
<div>{{item.a}}</div>
<div>{{item.b}}</div>
<div>{{item.c}}</div>
<div>{{item.d}}</div>
</div>
</div>
...but this will render a 4 blocks of each item in a row (I'd like the item.a ... item.d to make up the row elements, and each item to represent a row).
How would one be able to achieve this? or is this generally not possible with a template language?