How to display a table with 10 rows per page on jsreport?



  • I have tables more 100 rows. I want the table to only show 10 rows per page, and if I move to another page for the table, it shows me the next 10 rows and I have a handlebarjs that can be used on jsreport.

    Or I can use page breaks?

    Example:

    1 0000000 xxxx
    2 0000000 xxxx
    3 0000000 xxxx
    4 0000000 xxxx
    5 0000000 xxxx

    New Page

    6 0000000 xxxx
    7 0000000 xxxx
    8 0000000 xxxx
    9 0000000 xxxx
    10 0000000 xxxx

    My templates:

         {{#each POD}}
            {{#ifCond 0}}
                <tr style="font-size: 14px">
                    <td>{{seq}}</td>
                    <td>{{code}}</td>
                    <td>{{description}}</td>
                    <td>{{type}}</td>
                    <td>{{unit}}</td>
                    <td>{{lastPrice}}</td>
                    <td>{{unitPrice}}</td>
                    <td>{{disc1}}</td>
                    <td>{{disc2}}</td>
                    <td>{{disc3}}</td>
                    <td>{{discSPC}}</td>
                    <td>{{netPrice}}</td>
                    <td>{{qty}}</td>
                    <td>{{amount}}</td>
                </tr>
        {{else}}
         <tr style="font-size: 14px">
                <td>{{seq}}</td>
                <td>{{code}}</td>
                <td>{{description}}</td>
                <td>{{type}}</td>
                <td>{{unit}}</td>
                <td>{{lastPrice}}</td>
                <td>{{unitPrice}}</td>
                <td>{{disc1}}</td>
                <td>{{disc2}}</td>
                <td>{{disc3}}</td>
                <td>{{discSPC}}</td>
                <td>{{netPrice}}</td>
                <td>{{qty}}</td>
                <td>{{amount}}</td>
            </tr>
            {{/ifCond}}
        {{/each}}
    

    My Function:

     Handlebars.registerHelper('ifCond', function(v1, options) {
      if(v1%10 === 0 && v1 !== 0) {
        return options.fn(this);
      } 
      return options.inverse(this);
    });```

Log in to reply
 

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