primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Datatable 'first' property does not works

Open ccasallas opened this issue 9 years ago • 3 comments

I'm submitting a:

[ X ] bug report [ ] feature request [ ] support request

Datatable "first" property does not work. After change firstPage attribute in component the table keeps initial page:

<p-dataTable [value]="filteredLocations" [(selection)]="selectedLocation" dataKey="id" 
						 [paginator]="true" [pageLinks]="3" [rows]="rowsPerPage" [(first)]="firstPage">
		    	<p-header>Ubicaciones</p-header>
				<p-column [style]="{'width':'38px'}" selectionMode="single"></p-column>
				<p-column [filter]="true" field="name" header="Nombre"></p-column>
				<p-column [filter]="true" field="geography.name" header="Zona"></p-column>
		    </p-dataTable>

Angular version: 4.1.0 PrimeNG version: 4.1.0-rc.2

Someone also reproduce this problem for primeng 2.0.1: https://github.com/primefaces/primeng/issues/1046#issuecomment-310631292

regards,

Carlos.

ccasallas avatar Jun 23 '17 22:06 ccasallas

+1

atapas avatar Jun 25 '17 02:06 atapas

Unable to replicate, please provide a test case based on plunkr below and we'll review again.

http://plnkr.co/edit/Wj39h1?p=preview

cagataycivici avatar Jul 11 '17 08:07 cagataycivici

I´m using version 2.0.6 it was not working until I programally specified a page. It is not taking care of the page value you pass (it is calculated with the pair (first, rows), but you need to pass it.

Code working :

 public gridOptions = {
    first: 0,
    rows: 15,
    page: 1,
    sortField: null,
    sortOrder: 1
  };

    const opt = JSON.parse( localStorage.getItem ('LS_HOME-TABLE.gridOptions') );
    if (opt) {
        this.gridOptions = opt;
        this.dataTable.sortField = this.gridOptions.sortField;
        this.dataTable.sortOrder = this.gridOptions.sortOrder;
        this.dataTable.page = this.gridOptions.page;
        this.dataTable.sortSingle();
    }
    this.dataTable.paginate(this.gridOptions);

marcosybarraa avatar Jul 13 '17 08:07 marcosybarraa