PDF multiple records in a row with break

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1606

    PDF multiple records in a row with break

    Hello,
    I am trying to create a layout for PDF, where multiple linked records should be placed in three records in a row and then a break to the next row.
    This is the code I use, but the second row keeps stacking above the first row. What am I doing wrong? Her the code:


    Code:
    <table>
    <tbody>
    <tr>
    <!-- {{#each werkeAusstellungen}} -->
    {{#ifMultipleOf @key 3}}<br>{{/ifMultipleOf}}
    <td width="10%">{{imageTag bildID height="60px" width="auto"}}</td>
    <td width="20%">{{ausstellungsnummer}}&nbsp;{{name}}<b r>{{{legende}}}</td>
    <!-- {{/each}} -->
    </tr>
    </tbody>
    </table>
    The result:

    Click image for larger version  Name:	pdf_multiple.jpg Views:	0 Size:	49.9 KB ID:	94862
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    i think because your loop is within the same Tr you can try to and get it out like below:

    PHP Code:
    <table>
    <tbody>
    <!-- {{#each werkeAusstellungen}} -->
      <tr>
        {{#ifMultipleOf @key 3}}<br>{{/ifMultipleOf}}
          <td width="10%">{{imageTag bildID height="60px" width="auto"}}</td>
          <td width="20%">{{ausstellungsnummer}}&nbsp;{{name}}<br>{{{legende}}}</td>
      </tr>
    <!-- {{/each}} -->
    </tbody>
    </table>
    Also note that the documentation says this

    Note: Using <tr> and <td> tags along with {{#each}} helper is not recommended, since it breaks a layout of a contenteditable element.​
    Rabii
    Web Dev

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1606

      #3
      Thanks rabii,

      when I use your sequence, the editor moves the ifMultipleOf to the top:

      Code:
      {{#ifMultipleOf @key 3}}<br>{{/ifMultipleOf}}
      <table>
      <tbody>
      <tr>
      <!-- {{#each werkeAusstellungen}} --><td width="10%">{{imageTag bildID height="60px" width="auto"}}</td>
      <td width="20%">{{ausstellungsnummer}}&nbsp;{{name}}<b r="">{{{legende}}}</b></td>
      <!-- {{/each}} -->
      </tr>
      </tbody>
      </table>


      I already tested every position possible, without success.
      I use the normal HTML, because I can`t get rid of borders, when I use the table tags as recommended in the documentation. Anf even with table tags it does not work either.

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        Yeah i have tried various version and i think this helper {{#ifMultipleOf @key 3}}<br>{{/ifMultipleOf}} doesn't work well with tables.
        Rabii
        Web Dev

        Comment

        • item
          Active Community Member
          • Mar 2017
          • 1476

          #5
          <!-- {{#ifMultipleOf @key 3}} -->
          <br>
          <!-- {{/ifMultipleOf}} -->

          code view.. make so.. save shortcut : control s ? Mac : pomme s

          sorry on phone
          If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

          Comment

          • shalmaxb
            Senior Member
            • Mar 2015
            • 1606

            #6
            I tested quite the whole day any possible combination, with tables and without, also the proposal of item (commenting out) and nothing worked. I tried with six related records and there is one coding form, where it at least breaks after three records, but it stacks the second three records on top of the first (see my first thread). In any other positioning of the code parts (#each and #multipleOf) there happens nothing at all.
            My conclusion, as I am running out of ideas, is, that this helper does not work.

            Perhaps anybody has a working example?

            Comment


            • item
              item commented
              Editing a comment
              My post is more with wyziwyg editor with placeholder tag who change place on save or edit.
              I comment all placeholder tag and no issue with editor.
          • shalmaxb
            Senior Member
            • Mar 2015
            • 1606

            #7
            Meanwhile this has been solved, together with the help of Yuri: https://forum.espocrm.com/forum/gene...-does-not-work

            This helper works, but only with the pure field, not with table, not with any HTML-Tag as <br> or &nbsp;

            You may chain fields one after the other, for example:

            Code:
            {{#each entityName}}
            
            {{#ifMultipleOf @key 3}}<br>{{/ifMultipleOf}}{{number}} {{name}} {{status}}
            
            {{/each}}


            will print

            number1 name1 status1 number2 name2 status2 number3 name3 status3

            number4 name4 status4 .......

            every three items will start a new line. But no formatting possible. It leaves a space between the field, when you leave a space in code.

            Comment

            Working...