Body: <p>Every entry in a section has a table.  The table depicts sales over 7 years.</p>
  
  <p><strong>I want to create an <code>index page</code> that lists the title of each entry and the sales for each entry in the section.</strong>  </p>
  
  <p>I know how to loop through the table fields to template the table for each entry. </p>
  
  <p>I know how to loop through the titles of each entry to create an index page.</p>
  
  <p><strong>But, how do I create an index page that loops through the table data for each entry?</strong></p>
  
  <p>Simple index loop: </p>
  
  <pre><code>{% for item in craft.entries.section('widgets').all() %}
      &lt;li&gt;{{ item.title }}&lt;/li&gt;        
  {% endfor %}
  </code></pre>
  
  <p>The entry table format is as follows:</p>
  
  <pre><code>{% set field = craft.app.fields.getFieldByHandle('budgetTable') %}   
  
          &lt;table id="apaf" class="table table-striped table-bordered" style="width:100%"&gt;
              &lt;thead &gt;
                  &lt;tr&gt;
                      {% for column in field.settings.columns %}
                      &lt;th scope="col" style="font-weight: bold;"&gt;{{ column.heading }}&lt;/th&gt;
                      {% endfor %}
                  &lt;/tr&gt;    
              &lt;/thead&gt;     
  
              &lt;tbody&gt;
                  {% for row in entry.budgetTable %}
                  &lt;tr&gt;    
  
                      &lt;th scope="row" style="font-weight: bold;"&gt;{{ row.widgetTitle }}&lt;/th&gt;
  
                  &lt;/tr&gt;          
                  {% endfor %}
  
              &lt;/tbody&gt;          
          &lt;/table&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-18T21:07:40.850Z
Comments.Text: Not sure I'm following 100%.  `budgetTable` is the name of the Table field. Does it only have 1 column with a handle of `widgetTitle`?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-20T17:48:50.210Z
Comments.Text: @Brad Bell.  I only depict 1 column handle.  There are actually 10.
Comments.UserDisplayName: Hellyar
Tags: <templating><forloop><table-field><table>
Title: How do I create an index page that loop through the table fields of its entries?
ThreadText: # How do I create an index page that loop through the table fields of its entries?
  
  (Asked by: username_0 on 2018-05-18)
  
  Every entry in a section has a table. The table depicts sales over 7 years.
  
  **I want to create an `index page` that lists the title of each entry and the sales for each entry in the section.**
  
  I know how to loop through the table fields to template the table for each entry.
  
  I know how to loop through the titles of each entry to create an index page.
  
  **But, how do I create an index page that loops through the table data for each entry?**
  
  Simple index loop:
  
  ```
  {% for item in craft.entries.section('widgets').all() %}
      <li>{{ item.title }}</li>        
  {% endfor %}
  
  ```
  
  The entry table format is as follows:
  
  ```
  {% set field = craft.app.fields.getFieldByHandle('budgetTable') %}   
  
          <table id="apaf" class="table table-striped table-bordered" style="width:100%">
              <thead >
                  <tr>
                      {% for column in field.settings.columns %}
                      <th scope="col" style="font-weight: bold;">{{ column.heading }}</th>
                      {% endfor %}
                  </tr>    
              </thead>     
  
              <tbody>
                  {% for row in entry.budgetTable %}
                  <tr>    
  
                      <th scope="row" style="font-weight: bold;">{{ row.widgetTitle }}</th>
  
                  </tr>          
                  {% endfor %}
  
              </tbody>          
          </table>
  
  ```
  
  **Tags:** templating, forloop, table-field, table
  
  > **Comments:**
  > **username_1**: Not sure I'm following 100%.  `budgetTable` is the name of the Table field. Does it only have 1 column with a handle of `widgetTitle`?  
  > **username_0**: @username_1.  I only depict 1 column handle.  There are actually 10.  
  
  ---
  
  ## 0 answers
  
  