{% load dynamicforms %}

{% for row in data %}
  <tr data-id="{{ row.id }}" {% if forloop.first %}data-next="{{ link_next }}"
      data-previous="{{ link_prev }}" {% endif %}
      {% for key, value in row|items %}
        {% set_var column=serializer.fields|dict_item:key %}
        {% if key in serializer.fields and column.display_table == DYNAMICFORMS.DisplayMode.HIDDEN %}
      data-{{ key }}="{{ value }}"
        {% endif %}
      {% endfor %}
  >
    {% render_table_commands serializer "rowstart" %}
    {% for key, column in serializer.fields.items %}
      {% if column.display_table == DYNAMICFORMS.DisplayMode.FULL or column.display_table == DYNAMICFORMS.DisplayMode.INVISIBLE %}
        {% dict_item_default var='value' d=row k=key default='' %}
        <td {{ value|add_nested_class }}{% if column.display_table == DYNAMICFORMS.DisplayMode.INVISIBLE %} style="display: none" {% endif %} data-name="{{ key }}">
          {% render_table_commands serializer "fieldleft" key %}
          {{ value }}
          {% render_table_commands serializer "fieldright" key %}
        </td>
      {% endif %}
    {% endfor %}
    {% render_table_commands serializer "rowend" %}
  </tr>
{% empty %}
  <tr data-title="NoData">
    {% if columns_count == None %}
      {% table_columns_count serializer as columns_count %}
    {% endif %}
    <td colspan="{{ columns_count }}" style="text-align: center">No data</td>
  </tr>
{% endfor %}
