Problem with broken loop {{#each}} while saving PDF template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arturkulik
    Junior Member
    • Apr 2025
    • 22

    #1

    Problem with broken loop {{#each}} while saving PDF template

    What can be wrong if i create templete ( via code view) with



    <table class="bordered" style="width: 100%; border-collapse: collapse;"><tbody>

    <tr style="background:#eee;border-bottom:1px solid #eee;">
    headers
    </tr>

    {{#each............ }}
    <tr>
    DATA
    </tr>
    {{/each}}

    </table>



    after saving and editing again i got {{#each}} jumps before whole table:

    Click image for larger version  Name:	 Views:	0 Size:	8.0 KB ID:	117624
    Last edited by arturkulik; Today, 11:12 AM.
  • yuri
    Member
    • Mar 2014
    • 8936

    #2
    It was covered many many times on the forum.

    The recommended way is the 'iterate' attribute. https://docs.espocrm.com/user-guide/...#each-iterator
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • victor
      Active Community Member
      • Aug 2022
      • 902

      #3
      Hi arturkulik,

      From EspoCRM documantation:
      Using <tr> and <td> tags along with {{#each}} helper is not recommended as it breaks markup of a contenteditable element.
      A practically identical topic using iterate instead of {{#each}} has already been discussed on the forum: https://forum.espocrm.com/forum/deve...email-template with specific examples.

      Comment

      • arturkulik
        Junior Member
        • Apr 2025
        • 22

        #4
        after changing to iterate - i lost coding ( font still this same) and data, it sees records but not content. probably it should be addressed other way

        Comment

        • yuri
          Member
          • Mar 2014
          • 8936

          #5
          What EspoCRM version? There was a bug a couple versions back that has been already fixed.
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment


          • yuri
            yuri commented
            Editing a comment
            That bug was fixed in 9.0.3.
        • arturkulik
          Junior Member
          • Apr 2025
          • 22

          #6
          ok
          curr 8.4.2 we are upgrading to 9.1.1 in 30minutes,

          Thank You,

          If i need to start @index incrementing will it work to?

          Comment

          • yuri
            Member
            • Mar 2014
            • 8936

            #7
            Index does not work. If you need it, you can still use the each helper but wrapping it in HTML comments to prevent the markup from getting broken.
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment


            • yuri
              yuri commented
              Editing a comment
              Though it may still work with the attribute. I'm not sure.
          Working...