JSReport & Handlebars IF value is int

808 views Asked by At

Have been struggling with JSreport couple hours today making PDF report for my app. Now met the problem in if statement, where I need to compare index number to integer.

In Javascript I can compare like this if (partKey === 6), but with handlebars this is not working and I'll tried these with no luck:

{{#each computer.parts as |part partKey|}}
      <div class="item">
        <span>{{ part.productName }}, {{ part.weight }}g</span><br></br>
        {{ #if (eq partKey 6) }}
          <div style="page-break-before: always"></div>
        {{ /if }}
      </div>
      {{/each}}

I just want to change page after six objects. Also tried these; {{ #is partKey 6 }}, {{ #if_eq partKey 6 }}, {{ #equals partKey 6 }}.

Any ideas which should work?

If i print partKey like this {{ partKey }} it prints nicely. When I try to use it in if it gives a parse errpr, says partKey is Invalid.

0

There are 0 answers