Answers for "dynamic rowspan in jinji"

0

dynamic rowspan in jinji

<div class="table-responsive">
  <table class="table table-bordered">
    <thead>
      <tr>
        <th>Year</th>
        <th>Month</th>
        <th>Name</th>
      </tr>
    </thead>
    <tbody>
      {% for yr in yrs %}
        {% set yr_loop = loop %}
        {% for month in months[loop.index0] %}
          {% set month_loop = loop %}
          {% for name in names[yr_loop.index0][loop.index0] %}
            <tr>
              {% if loop.first %}
                {% if month_loop.first %}
                  <td rowspan="{{ names[yr_loop.index0]|sum(start=[])|count }}">{{ yr }}</td>
                {% endif %}
                <td rowspan="{{ loop.length }}">{{ month }}</td>
              {% endif %}
              <td>{{ name }}</td>
            </tr>
        {% endfor %}
      {% endfor %}
    </tbody>
  </table>
<div>
Posted by: Guest on August-15-2021
0

dynamic rowspan in jinji

<table>
 <thead>
  {%- for column in columns %}
     <th>{{ column }}</th>
  {%- endfor %}
 </thead>

 <tbody>
 {%- for row in items %}
    <tr>
    {%- for column in columns %}
       <td>{{ row|attr(column) }}</td>
    {%- endfor %}
    </tr>
 {%- endfor %}
 </tbody>
 </table>
Posted by: Guest on August-15-2021

Browse Popular Code Answers by Language