How to iterate over data in a bootstrap-style knockout branch?

This must be unique: p

I am using twig in symfony2. I arrange it with a bootstrap layout. Here, I sort through the data with a knockout, with 4 (span3) in a row (every fifth will turn around). But I do not know how to identify every 4th iteration.

<div class="row-fluid">
    <div class="structureWhite clearfix" data-bind="foreach: stores">
        <div class="span3">
            <h5 data-bind="text: name"></h5>
            <p data-bind="text: address"></p>
            <p data-bind="text: contact"></p>
        </div>
    </div>
</div>

Therefore, I need to either put <div class="row-fluid"></div>after every 4th iteration, or delete every fifth marker. The problem is that bootstrap doesn't give the first span3 fields, but everyone else gets margin-left: 2.12766%. This means that the 5th span3 (the first in the second line) is out of line.

Thus, either I have to break it into a fluid line, or remove the gasket on the 5th element (or after every 4th) or add (although it will respond with such a variable) to the first. Any advice is appreciated.

+3
1

KO 2.1 $index, foreach, .

, , , :

<!-- ko if: $index() % 4 === 3 -->
<div>some element</div>
<! /ko -->
+3

All Articles