CustomTemplateBody records not aligned

hi, please, using the CustomTemplateBody custom template, my records, are not vertically aligned. like

aaa   bbbb   23333
bbb  cccc  4444
ddd  eeee 344

this is my code, and please how can I add the columns names for the list?

<table class="ew-table no-border">
 
  {{{list_options 2}}}
    <td {{{recordId}}}  /td>
 ..... rest of the fields

  
  </table>

thank you for your help

Your HTML template contains incomplete <td> tag and is missing <tr> tag.

I advise you to use artificial intelligence to create codes and deal with them to solve code problems. Artificial intelligence made me leaps forward and accelerated my processes in creating codes quickly and solving problems.

e.g.


:white_check_mark: Explanation of the Problem:

The issue happens because:

  • There are no <tr> tags wrapping each row.
  • You’re placing <td>s directly without defining which data belongs to which row.
  • Also, the table is missing a <thead> section to display column headers.

:white_check_mark: Solution:

To fix the layout and add column names:

  1. Use the {{{records}}}...{{{/records}}} block to loop through rows.
  2. Add <tr> inside that block to wrap each record.
  3. Add a <thead> section with <th> elements to define the column headers.
  4. Make sure each data field is inside a <td>.

:jigsaw: Complete Fixed Code:

html

نسختحرير

<table class="ew-table table-sm table-striped table-bordered">
  <thead class="table-light">
    <tr>
      <th>{{{caption field1}}}</th>
      <th>{{{caption field2}}}</th>
      <th>{{{caption field3}}}</th>
      <!-- Add more columns as needed -->
    </tr>
  </thead>
  <tbody>
    {{{records}}}
    <tr>
      {{{list_options 2}}}
      <td>{{{value field1}}}</td>
      <td>{{{value field2}}}</td>
      <td>{{{value field3}}}</td>
      <!-- Add more fields as needed -->
    </tr>
    {{{/records}}}
  </tbody>
</table>

:memo: Notes:

  • Replace field1, field2, field3 with the actual field names from your table.
  • {{{caption fieldX}}} automatically pulls the field label from PHPMaker settings.
  • {{{list_options 2}}} should remain inside the <tr> so the row actions (like edit/delete buttons) render correctly.

Let me know if you’d like to add buttons like View, Edit, or Delete at the end of each row. I can include them too!

AI ChatGPT