Handlebars, how to repeat header when looping the data


#1

I have problem with handlebars, after item.breakPage in my code, ember always skip the html tags, anyone can help me ? thanks before :slight_smile:

 <table class="table table-responsive  w960">
            <tr>
                <th class="left" width="20px" >No</th>
                <th class="left" >Description</th>
                <th class="left" >Note.</th>
                <th class="right" >Total</th>
            </tr>
            {{#each item in voucher}}
            <tr>
                <td class="left">{{item.no}}</td>
                <td class="left">{{item.item_description}}</td>
                <td class="left">{{item.item_note}}</td>
                <td class="right">{{format-number item.debit}}</td>
            </tr>
    {{#if item.breakPage}}
        </table>

{{/if}} {{/each}}
No Description Note. Total
{{header.description}} (+) Total (IDR) {{format-number totalDebit}}

#2

I don’t think you can interleave the opening and closing of tags that way. Perhaps you’ll have to group the items in the controller, each group ending with an item where breakPage is true.


#3

Indeed, you can’t wrap starting or closing tags separately.