I'm using Marionette for a while, but I'm not sure how I can do what I want, in a simple manner.
I have a composite view, which renders something like this:
<div class="row">
<div class="col-xs-12">
<div id="items"></div>
</div>
</div>
Each of my item is being rendered as a:
<div class="col-xs-3">foo</div>
The problem here is, is that every 4 items, I want to render a new row, so things are pretty and do not screw up bootstrap's grid spacing.
In sum, if I just render them as they are, this will happen:
<div class="row">
<div class="col-xs-12">
<div id="items">
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
</div>
</div>
</div>
As you can see, this breaks up bootstrap, because we have a lot more then 12 grid space in those item divs.
What I want is:
<div class="row">
<div class="col-xs-12">
<div id="items">
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div id="items">
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
<div class="col-xs-3">foo</div>
</div>
</div>
</div>
What is an wasy way to achieve that effect? I should have a view for rows, and view for a collection of rows and a view for each item? That just seems too much trouble.
min-height
to thecol-xs-3
elements, you should not need any extra row wrapper, as they will gracefully overflow to a new line. Otherwise you need a collection of simpleCollectionViews
s, which does not seem a big drama either. – moonwave99