handlebar-helper {{attr}} not working with colspan



  • I am trying to use the following helpers {{attr colspan=(add samples.length 1)}} while this appears to render correctly as plain text it does not work when on a <td> element. Here is my code snippet:

    {{attr colspan=(add samples.length 1)}}
    <table class="table table-bordered table-condensed">
        <tr>
            <td {{attr colspan=(add samples.length 1)}} class="sample-info-th text-center">
                <strong>Sample History</strong>
            </td>
            <td class="sample-info-th text-center" colspan="2"></td>
        </tr>
        <tr>
            <td >Sample Date</td>
            {{#each samples as |sample index|}}
            <td > {{date sample._kmd.ect "DD/MM/YYYY"}} </td>
            {{/each}}
        </tr>
        <tr>
          <td>ID</td>
          {{#each samples as |sample index|}}
          <td >{{sample.BottleBarcode}}</td>
          {{/each}}
        </tr>
        <tr>
          <td>SMU</td>
          {{#each samples as |sample index|}}
          <td  >{{sample.SMU}}</td>
          {{/each}}
        </tr>
        <tr>
          <td>Oil Changed</td>
          {{#each samples as |sample index|}}
          <td >{{sample.OilChanged}}</td>
          {{/each}}
        </tr>
        <tr>
    

    0_1521302391597_upload-69f9b7ff-1903-4cdc-a991-db9ace725dcb



  • Please provide playground link replicating the issue. Thank you.
    https://playground.jsreport.net/



  • How do I allow the handlebar-helper module in the playground?



  • Ah, that is not possible.

    Could you try to use {{{atr .... }}} ? That could help



  • Found the following workaround

    {{lookup (first test) "a"}}
    {{lookup (last test) "a"}}
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.