Primeng: [datatable]: number of records with/without paginator and filtering

Created on 10 Nov 2017  路  7Comments  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
http://plnkr.co/edit/jhkD6vKRSLDu9OEeF1Zn?p=preview

Current behavior
I'd like to display the number of (filtered) records of the dataTable.
In principle, exactly what totalRecords does, but this is undefined without a paginator:
http://plnkr.co/edit/jhkD6vKRSLDu9OEeF1Zn?p=preview

Currently this is only possible by using dataToRender, which on the other hand does not work when i use a paginator

{{dataTable?.dataToRender?.length}} 

So i'd like to have one consistent way (public API) to be able to do this.

Summary:
Instead of

      <span *ngIf="pagination">
        {{dataTable?.totalRecords}}
      </span>
      <span *ngIf="!pagination">
        {{dataTable?.dataToRender?.length}}
      </span>

I want to be able to use

      <span>
        {{dataTable?.totalRecords}} <!-- or a different property, which is exposed as "API" -->
      </span>

What is the motivation / use case for changing the behavior?
Reduce complexity, easier to use API

  • Angular version: 4.4.6

  • PrimeNG version: 4.3.0

Most helpful comment

@cagataycivici How is this possible with the new p-table? Is there a similar way to get the displayed rows count?

All 7 comments

p-dataTable is deprecated and will be removed in favor of the new p-table (aka TurboTable) of 5.1.0 so closing the issue. Please try the new p-table once 5.1.0 is released.

@cagataycivici How is this possible with the new p-table? Is there a similar way to get the displayed rows count?

@jbgarr I'm also facing same issue. Plz update here if u find any solution. Thanks

Same here...

@lebnic Plz let me know of any solutions (or alternative library) u find for this purpose. Thanks

@izy2nv try:

let dataToRender = dataTable.filteredValue || dataTable.value;

@lebnic sure. I'll try it. Thanks!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gatapia picture gatapia  路  3Comments

mitosandov picture mitosandov  路  3Comments

watalberto picture watalberto  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

markgoho picture markgoho  路  3Comments