ng-datatable/src/app/app.component.html
2018-06-08 12:47:47 -04:00

25 lines
1.2 KiB
HTML

Table CSS
<input [(ngModel)]="tableCSS"> Selection Mode
<select [(ngModel)]="selectionMode">
<option>None</option>
<option>single</option>
<option>multi</option>
</select>
Checkbox
<input type="checkbox" [(ngModel)]="checkbox"> Expandable
<input type="checkbox" [(ngModel)]="expandable">
<br>
<br>
<input placeholder="Search" (keyup)="search.next($event.target.value)">
<br> Selected: {{table.selectedRows.size}}/{{table.processedData.length}}
<ng-datatable #table [cssClass]="tableCSS" [columns]="columns" [data]="data" [expandedTemplate]="expandable ? expanded : null"
[showCheckbox]="checkbox" [paginate]="false" [selectionMode]="selectionMode == 'None' ? null : selectionMode" (rowSelected)="log($event)">
<ng-template #expanded let-object="object">
Hello {{object.firstName}} {{object.lastName}}, How are you today?
<span *ngIf="object.age < 18">I can see that you are under age.</span>
<span *ngIf="object.age > 84">I can see that you are over the average life expectancy.</span>
</ng-template>
<ng-template #age let-value="value">
<strong [ngClass]="{'text-success': value < 18, 'text-danger': value > 84}">{{value}}</strong>
</ng-template>
</ng-datatable>