title: Create new row every 2 records using knockout foreach
body: <p>I'm attempting to create a new row every two records using knockout virtual elements. My problem is that the odd record does not generate in between the two even indexes.</p>
  
  <h3>Here's my source HTML</h3>
  
  
  
  <pre class="lang-html prettyprint-override"><code>   &lt;!--ko foreach:UDGroupboxes--&gt;
      &lt;!--ko if:$index()%2==0 || $index()==0--&gt;
      &lt;div class="row-fluid"&gt;
      &lt;!--/ko--&gt;
          &lt;div class="panel form-horizontal span6"&gt;
              &lt;div class="panel-heading"&gt;&lt;span data-bind="text:$data.Caption"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;/div&gt;
       &lt;!--ko if:$index%2()!=0 &amp;&amp; $index()!=0--&gt;
      &lt;/div&gt;
      &lt;!--/ko--&gt;
      &lt;!--/ko--&gt;
  </code></pre>
  
  <h3>The output HTML</h3>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div data-bind="attr:{id:Name}" class="tab-pane active" id="Tabsheet1"&gt;
      &lt;!--ko foreach:UDGroupboxes--&gt;
      &lt;!--ko if:$index()%2==0 || $index()==0--&gt;
      &lt;div class="row-fluid"&gt;
      &lt;!--/ko--&gt;
          &lt;div class="panel form-horizontal span6"&gt;
              &lt;div class="panel-heading"&gt;&lt;span data-bind="text:$data.Caption"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;/div&gt;
       &lt;!--ko if:$index%2()!=0&amp;&amp;$index()!=0--&gt;
      &lt;/div&gt;
      &lt;!--/ko--&gt;
  
      &lt;!--ko if:$index()%2==0 || $index()==0--&gt;&lt;!--/ko--&gt;
  
      &lt;!--ko if:$index()%2==0 || $index()==0--&gt;
      &lt;div class="row-fluid"&gt;
      &lt;!--/ko--&gt;
          &lt;div class="panel form-horizontal span6"&gt;
              &lt;div class="panel-heading"&gt;&lt;span data-bind="text:$data.Caption"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;/div&gt;
       &lt;!--ko if:$index()%2!=0&amp;&amp;$index()!=0--&gt;
      &lt;/div&gt;
      &lt;!--/ko--&gt;
      &lt;!--/ko--&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The panel should be generated no matter the condition. The condition only determines to open a new row on even numbers and close the row on odds.</p>