Files
alfresco-ng2-components/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
2016-06-02 14:47:04 +01:00

63 lines
2.5 KiB
HTML

<table
*ngIf="data"
class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
<thead>
<tr>
<!-- Columns -->
<th *ngIf="multiselect">
<label
class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect mdl-data-table__select"
[class.is-checked]="isSelectAllChecked"
for="table-header"
(click)="onSelectAllClick($event)">
<input type="checkbox" id="table-header" class="mdl-checkbox__input" />
</label>
</th>
<th class="mdl-data-table__cell--non-numeric non-selectable {{col.cssClass}}"
*ngFor="#col of data.getColumns()"
[class.column-header]="col.title"
[class.mdl-data-table__header--sorted-ascending]="isColumnSorted(col, 'asc')"
[class.mdl-data-table__header--sorted-descending]="isColumnSorted(col, 'desc')"
(click)="onColumnHeaderClick(col)">
<span *ngIf="col.srTitle" class="sr-only">{{col.srTitle}}</span>
<span *ngIf="col.title">{{col.title}}</span>
</th>
<!-- Actions -->
<th *ngIf="actions">
<span class="sr-only">Actions</span>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="#row of data.getRows(); #idx = index">
<td *ngIf="multiselect">
<label
class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect mdl-data-table__select"
[attr.for]="'row[' + idx + ']'"
[class.is-checked]="row.isSelected">
<input type="checkbox" [attr.id]="'row[' + idx + ']'" class="mdl-checkbox__input" [(ngModel)]="row.isSelected" />
</label>
</td>
<td *ngFor="#col of data.getColumns()" [ngSwitch]="col.type"
class="mdl-data-table__cell--non-numeric data-cell non-selectable {{col.cssClass}}"
(click)="onRowClick(row, $event)" (dblclick)="onRowDblClick(row, $event)">
<div *ngSwitchWhen="'image'">
<i *ngIf="isIconValue(row, col)" class="material-icons icon-cell">{{asIconValue(row, col)}}</i>
<img *ngIf="!isIconValue(row, col)" class="image-cell" alt="" src="{{data.getValue(row, col)}}">
</div>
<div *ngSwitchWhen="'text'">
{{data.getValue(row, col)}}
</div>
<span *ngSwitchDefault>
<!-- empty cell for unknown column type -->
</span>
</td>
<td *ngIf="actions"><!-- todo: actions --></td>
</tr>
</tbody>
</table>