object.style.gridAutoFlow = "value";
<'grid-auto-flow'> = [ row | column ] || dense
row
Places items by filling each row in turn, adding new rows as necessary.
column
Places items by filling each column in turn, adding new columns as necessary.
dense
Attempts to fill in holes earlier in the grid if smaller items come up later.