<div class="query-table">
  <table class="table table-striped table-condensed">
    <thead>
      <tr>
        <th class="checkbox-heading">
          <div class="form-group">
            <label class="form-checkbox">
                            <input type="checkbox" on:el:change="toggleSelectAll" el:checked:from="_allSelected" />
                            <i class="form-icon"></i>
                        </label>
          </div>
        </th>
        {{#each fields}}
          <th {{#is name currentSort.field}} class="text-bold {{#if classes}}{{classes}}{{/if}}"{{/is}}{{#if ./sort}} on:el:click="setSort(name)"{{/if}}>
            {{alias}}
            {{#is name currentSort.field}}<i class="fa fa-sort-{{#is currentSort.type 'desc'}}desc{{else}}asc{{/is}}"></i>
            <i class="fa fa-times float-right" on:el:click="setSort('', %event)" title="Clear Sort"></i>{{/is}}
          </th>
        {{/each}}
      </tr>
    </thead>

    <tbody>
      {{#each objects object=value}}
        <tr {{#if isSelected(object)}} class="selected" {{/if}}>
          <td class="checkbox-cell">
            <div class="form-group d-inline-block">
              <label class="form-checkbox">
                  <input type="checkbox" on:el:change="toggleSelected(object)" el:checked:from="isSelected(object)" />
                  <i class="form-icon"></i>
              </label>
            </div>
          </td>
          {{#each fields field=value}}
            <td {{#if classes}}class="{{classes}}"{{/if}}>
                {{ >field.displayTemplate}}
            </td>
          {{/each}}
        </tr>
      {{/each}}
    </tbody>
  </table>
</div>
