angular-5-data-table icon indicating copy to clipboard operation
angular-5-data-table copied to clipboard

No page limits?

Open eappell opened this issue 7 years ago • 4 comments

I'm trying to get this to work for me, and I'm almost there. I'm using my own data, which does populate the table, but there are 1000 items in the data, and it displays all of them. The paging controls are there, but it's not limiting the displayed table to anything. It just shows them all. Where do I specify the page limit? I can't see that using the demo... Everything else works. Thanks for the help!

eappell avatar Feb 16 '18 23:02 eappell

image

prakashkaruppiah avatar Feb 17 '18 06:02 prakashkaruppiah

Thank you, I added that to my table definition, and in the pager at the bottom of the table, it says 10 for the limit, but it's still showing 1000 rows. See the screenshot. The first column is the count. It starts with 1, and that's the bottom of the table. Can you think of any other reason why it would do this? I must be missing some other setting or data requirement, I just don't know what... tablelimit

eappell avatar Feb 20 '18 15:02 eappell

I am facing the same issue, it's displaying all of the rows

mezubeen avatar Feb 24 '18 11:02 mezubeen

Hi, I tried like this way.. my problem is solved

unitmaster-component.ts import { Component, OnInit,ViewChild } from '@angular/core'; import { DataTable, DataTableTranslations, DataTableResource } from '../modules/data-table';

constructor( private test_Service: test_Service, private router: Router ) { this.DataResource.count().then(count => this.filmCount = count); }

films = []; filmCount = 0; translations = <DataTableTranslations>{ indexColumn: 'Index column', expandColumn: 'Expand column', selectColumn: 'Select column', paginationLimit: 'Max results', paginationRange: 'Result range' };

reloadFilms(params) {
    this. test_Service.queryGetAll(params, this.unitMasterAPIurl).then(result => {
        this.films = result.items;
        this.filmCount = result.count;
        this.DataResource = new DataTableResource(this.films);
        this.DataResource.query(params).then(films => this.films = films);
        this.DataResource.count().then(count => this.filmCount = count);
    });

}

Test_service.ts queryGetAll(params: DataTableParams,apiUrl:any) { return this._http.get(apiUrl + '?' + paramsToQueryString(params)).toPromise() .then((resp: Response) => ({ items: resp.json(), count: Number(resp.headers.get('X-Total-Count')) })); }

function paramsToQueryString(params: DataTableParams) { const result = [];

if (params.offset != null) { result.push(['_start', params.offset]); } if (params.limit != null) { result.push(['_limit', params.limit]); } if (params.sortBy != null) { result.push(['_sort', params.sortBy]); } if (params.sortAsc != null) { result.push(['_order', params.sortAsc ? 'ASC' : 'DESC']); }

return result.map(param => param.join('=')).join('&'); }

prakashkaruppiah avatar Feb 26 '18 04:02 prakashkaruppiah