Skip to content

Commit

Permalink
Enhancement primefaces#636 Add currentPageReportTemplate property to …
Browse files Browse the repository at this point in the history
…Paginator
  • Loading branch information
superhp committed Nov 9, 2018
1 parent 53078cf commit 952f42f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/paginator/Paginator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface PaginatorProps {
style?: object;
className?: string;
template?: string;
currentPageReportTemplate?: string;
leftContent?: JSX.Element | undefined;
rightContent?: JSX.Element | undefined;
onPageChange?(event: PageState): void;
Expand Down
4 changes: 3 additions & 1 deletion src/components/paginator/Paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Paginator extends Component {
style: null,
className: null,
template: 'FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown',
currentPageReportTemplate: '({currentPage} of {totalPages})',
onPageChange: null,
leftContent: null,
rightContent: null
Expand All @@ -34,6 +35,7 @@ export class Paginator extends Component {
style: PropTypes.object,
className: PropTypes.string,
template: PropTypes.string,
currentPageReportTemplate: PropTypes.string,
onPageChange: PropTypes.func,
leftContent: PropTypes.any,
rightContent: PropTypes.any
Expand Down Expand Up @@ -172,7 +174,7 @@ export class Paginator extends Component {
break;

case 'CurrentPageReport':
element = <CurrentPageReport key={key} page={this.getPage()} pageCount={this.getPageCount()} />;
element = <CurrentPageReport key={key} page={this.getPage()} pageCount={this.getPageCount()} template={this.props.currentPageReportTemplate} />;
break;

default:
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/paginator/PaginatorDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ import {Paginator} from 'primereact/paginator';
<td>FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown</td>
<td>Template of the paginator.</td>
</tr>
<tr>
<td>currentPageReportTemplate</td>
<td>string</td>
<td>{'({currentPage} of {totalPages})'}</td>
<td>Template of current page report. Two possible indicators: {'{'}currentPage{'}'} and {'{'}totalPages{'}'}. CurrentPageReport key has to be set in template property. </td>
</tr>
<tr>
<td>leftContent</td>
<td>any</td>
Expand Down

0 comments on commit 952f42f

Please sign in to comment.