Creating PDF template - source code has become unusable when opening for changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • delarosa
    Junior Member
    • Jul 2020
    • 8

    Creating PDF template - source code has become unusable when opening for changes

    Hello everyone,

    I have a small problem when creating PDF templates.

    I have created the following template:
    -------
    <table class=“bordered” style=“width: 100%; border-collapse: collapse;”>
    <tbody>
    <tr>
    <td>Cost 100 km</td>
    <td>km old</td>
    <td>km new</td>
    </tr>
    {{#each renaultConsumption}}
    <tr>
    <td>{{kosten100Km}}</td>
    <td>{{kMAlt}}</td>
    <td>{{kMNew}}</td>
    </tr>
    {{/each}}
    </tbody>
    </table>
    -------
    Everything works wonderfully. But when I want to change the code, EspoCrm simply formats it unbreakable:
    -------
    {{#each renaultConsumption}}

    {{/each}}
    <table class=“bordered” style=“width: 100%; border-collapse: collapse;”>
    <tbody>
    <tr>
    <td>Cost 100 km</td>
    <td>km old</td>
    <td>km new</td>
    </tr><tr>
    <td>{{kosten100Km}}</td>
    <td>{{kMAlt}}</td>
    <td>{{kMNew}}</td>
    </tr></tbody>
    </table>
    -------
    This makes the code unbreakable for a change.
    Do I have to edit my code in a different editor and save it there every time before saving?

    What might I be doing wrong?
    Is there another solution?

    Thanks in advance for your help.

    P.S. By the way, EspoCrm is the best I have ever used for my administrations. Thanks again to the team for this first-class work.
    Attached Files
  • yuri
    Member
    • Mar 2014
    • 8681

    #2
    Hi,

    Using helpers within a table tag breaks HTML markup. The contenteditable element does not allow it.

    It's covered in the docs (in the Note section): https://docs.espocrm.com/user-guide/...#each-iterator

    It's recommended to use the special attribute "iterate".
    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
      Member
      • Mar 2014
      • 8681

      #3
      It should be like this:

      Code:
      <tr iterate="{{renaultConsumption}}">
          <td>{{kosten100Km}}</td>
          <td>{{kMAlt}}</td>
          <td>{{kMNew}}</td>
      </tr>
      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

      • delarosa
        Junior Member
        • Jul 2020
        • 8

        #4
        Hello Yuri,

        You are the best.

        I have implemented it in the PDF template in exactly the same way and it works without errors.
        Even when reopening, the code remains formatted as I would like it to be.

        Many thanks for the quick help to you and the team.

        Have a nice day everyone.

        Ben
        Attached Files

        Comment

        Working...