In the documentation of ng2-ya-table
the datasource function is written in this way :
public datasource: any = (request: any): Observable<any> => {
return this.service.getUsers(request);
}
And used like this :
<ng2-ya-table [options]="options" [columns]="columns" [datasource]="datasource" [paging]="paging">
</ng2-ya-table>
I don't want to use this function in this way because I have static
data = [
{
name: 'Patricia',
email: '[email protected]',
username: 'Yes',
},
{
name: 'Chelsey Dietrich',
email: '[email protected]',
username: 'No',
}
]
Is that possible or I am obliged to render observable type? I tried a lot using static data but in vain
public datasource: any = {
return this.data ;
}
why this function is not working?
Try with:
Anyway, you need to perform pagination, sorting and filtering client side (the data source is an Observable in order to perform this operation server side). For example (pagination only):