Witam.
Chce zrobic wlasna tabele, z filtrem, sortowaniem oraz paginacja. Wywolanie mojej tabeli wyglada nastepujaco (przyklad):
.html
<my-table>
<my-table-row *ngFor="let f of details.finished">
<my-table-col>{{f.tester}}</my-table-col>
<my-table-col>{{f.tester}}</my-table-col>
<my-table-col>{{f.tester}}</my-table-col>
<my-table-col>{{f.tester}}</my-table-col>
</my-table-row>
</my-table>
komponent:
import { Component, Input, OnInit } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { MyTableFilterPipe } from '../services/my-table-filter.pipe'
@Component({
selector: 'my-table',
template: `
<div style="width: 100%">
<div style="float: left; height: 50px; width: 100%">
Search: <input type="text" [(ngModel)]="filterValue" style="height: 30px; border: 1px solid silver"/>
</div>
<div style="float: left; width: 100%">
<table>
<ng-content></ng-content>
</table>
</div>
</div>
`
})
export class MyTableComponent {
filterValue: string;
}
@Component({
selector: 'my-table-row',
template: `
<tr><ng-content></ng-content></tr>
`
})
export class MyTableRowComponent {
constructor() {
}
}
@Component({
selector: 'my-table-col',
template: `
<td><ng-content></ng-content></td>
`,
providers: [ MyTableFilterPipe ]
})
export class MyTableColComponent {
}
Jak teraz przefiltrowac dane w tabeli custom filtrem? W zadnym komponencie nie przetrzymuje tych danych a jedynie uzywam ngFor w template.
Pozdrawiam