<table class="table table-hover <% if @class: %><%- @class %><% end %>">
  <thead>
    <tr>
    <% if @checkbox: %>
      <th style="width: 40px" class="no-padding">
        <label class="checkbox-replacement">
          <input type="checkbox" value="" name="bulk_all">
          <%- @Icon('checkbox', 'icon-unchecked') %>
          <%- @Icon('checkbox-checked', 'icon-checked') %>
        </label>
      </th>
    <% end %>
    <% if @radio: %>
      <th style="width: 22px"></th>
    <% end %>
<% for item in @header: %>
      <th<% if item.className: %> class="<%= item.className %>"<% end %><% if item.style: %> style="<%= item.style %>"<% end %>><%- @T( item.display ) %></th>
<% end %>
<% if @destroy: %>
      <th><%- @T('Delete') %></th>
<% end %>
    </tr>
  </thead>
  <tbody>
<% position = 0 %>
<% length = @header.length %>
<% if @checkbox || @radio: %>
<%   length++ %>
<% end %>
<% groupLast = '' %>
<% for object in @objects: %>
  <% if @groupBy: %>
  <%   groupByName = @P( object, @groupBy ) %>
  <%   if groupLast isnt groupByName: %>
  <tr class=""><td colspan="<%= length %>"><b><%= groupByName %></b></td></tr>
  <%     groupLast = groupByName %>
  <%   end %>
  <% end %>
  <% position++ %>
  <tr class="item<% if object.active is false: %> is-inactive<% end %>" data-id="<%= object.id %>" data-position="<%= position %>" >
    <% if @checkbox: %>
      <td class="no-padding">
        <label class="checkbox-replacement">
          <input type="checkbox" value="<%= object.id %>" name="bulk">
          <%- @Icon('checkbox', 'icon-unchecked') %>
          <%- @Icon('checkbox-checked', 'icon-checked') %>
        </label>
      </td>
    <% end %>
    <% if @radio: %>
      <td class="no-padding">
        <label class="radio-replacement">
          <input type="radio" value="<%= object.id %>" name="radio">
          <%- @Icon('radio', 'icon-unchecked') %>
          <%- @Icon('radio-checked', 'icon-checked') %>
        </label>
      </td>
    <% end %>
    <% for item in @header: %>
      <% value = @P( object, item.name ) %>
      <% if @callbacks: %>
      <%   if item.name.substr(item.name.length-3, item.name.length) is '_id' && object[ item.name.substr(0, item.name.length-3) ]: %>
      <%     refObject = object[ item.name.substr(0, item.name.length-3) ] %>
      <%   end %>
      <%   for attribute, callbacksAll of @callbacks: %>
      <%     if attribute is item.name: %>
      <%       for callback in callbacksAll: %>
      <%         value = callback( value, object, item, @header, refObject ) %>
      <%       end %>
      <%     end %>
      <%   end %>
      <% end %>

      <td <% if item.parentClass: %>class="<%= item.parentClass %>"<% end %>>
        <% if item.name is 'icon': %>
          <%- @Icon('priority', item.class) %>
        <% else: %>
          <% if item.link: %>
            <a href="<%- item.link %>" <% if item.target: %>target="<%= item.target %>"<% end %>>
          <% end %>
          <% if item.raw: %>
            <%- item.raw %>
          <% else: %>
          <span <% if item.class: %>class="<%= item.class %>"<% end %> <% if item.title: %>title="<%= item.title %>"<% end %> <% if item.data: %><% for data_key, data_item of item.data: %>data-<%- data_key %>="<%= data_item %>" <% end %><% end %>>
            <%- value %>
          </span>
          <% end %>
          <% if item.link: %></a><% end %>
        <% end %>
      </td>
    <% end %>
    <% if @destroy: %>
      <td data-type="destroy"><%- @Icon('trash') %></td>
    <% end %>
  </tr>
<% end %>
  </tbody>
</table>