You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the suggestions. I wonder whether the proposed pApi.getItemsPerPage() is really needed, since this information is readily available since it is defined by the user config. If the motivation for adding this API so that the itemsPerPage value does not need to be explicitly passed down to the custom template?
Regarding the pApi.getTotalItems() method, this is certainly something that is not easily achievable currently in the case of things like a filter pipe which changes the size of the set (see #166, #99).
In the case of an array of items which is being filtered by some custom pipe prior to pagination, the total length is already being stored internally in the PaginationInstance (see here) so this could be exposed in the PaginationControlsDirective with a method like:
getTotalItems(): number {returnthis.service.getInstance(this.id).totalItems}
BTW, If you feel inclined to submit a pull request for this, let me know. Otherwise I will mark it to add in a future update.
Hi Team,
Is it possble to provide new methods (pApi.getTotalItems(), pApi.getItemsPerPage()) from paginationApi.
Scenario (using angular 5):
Sample screenshot
(with filterBy)
Using with data filter, inside "pagination-template", to display "Displaying 1 - 12 of 63" along with number of pages
Sample Code:
<tr *ngFor="let row of dataCollection | filterBy: searchText | orderBy:{ property: sortBy, direction: reverse } | paginate: { itemsPerPage: itemsPerPage, currentPage: p }; let i = index" class="cald_tr_cells">
.....
<pagination-template #pApi="paginationApi" [id]="custom" (pageChange)="p = $event"><div class="range-label" style="padding-top: 5px;padding-left: 5px;">Displaying {{(( p > 1 ? p : 1 ) - 1) * pApi.getItemsPerPage() + 1}} - {{(( ( p > 1 ? p : 1 ) - 1) * pApi.getItemsPerPage()) + pApi.getItemsPerPage() > pApi.getTotalItems() ? pApi.getTotalItems() : ((( p > 1 ? p : 1 ) - 1) * pApi.getItemsPerPage()) + pApi.getItemsPerPage()}} of {{ pApi.getTotalItems() }}</div> <!-- some code to design pages --></pagination-template>
Regards,
Satya
The text was updated successfully, but these errors were encountered: