diff --git a/src/app/components/components/paging/paging.component.html b/src/app/components/components/paging/paging.component.html index 916f3d0eda..e07344ed9b 100644 --- a/src/app/components/components/paging/paging.component.html +++ b/src/app/components/components/paging/paging.component.html @@ -8,17 +8,16 @@

Change Event:

-

Page Size: {{event?.pageSize || '100'}}

-

Page: {{event?.page || '1'}} of {{event?.maxPage || '14'}}

-

Rows: {{event?.fromRow || '1'}} to {{event?.toRow || '100'}}

+

Page Size: {{event1?.pageSize || '100'}}

+

Page: {{event1?.page || '1'}} of {{event1?.maxPage || '14'}}

+

Rows: {{event1?.fromRow || '1'}} to {{event1?.toRow || '100'}}

-

Total: {{event?.total || '1345'}}

+

Total: {{event1?.total || '1345'}}

- + Row per page: - {{pagingBar.range}} of {{pagingBar.total}} + {{pagingBar1.range}} of {{pagingBar1.total}} @@ -27,8 +26,7 @@

HTML:

+ Row per page: { {pagingBar.range} } of { {pagingBar.total} } @@ -65,77 +63,81 @@ + + - TdPagingBarComponent - How to use this component + Paging using input + Navigate to a specific page - -

]]>

-

Use ]]> element to generate a paging bar.

-

The (change) event throws an event with the following interface:

- - - -

Properties:

-

The ]]> component has {{pagingBarAttrs.length}} properties:

- - - -

{{attr.name}}: {{attr.type}}

-

{{attr.description}}

-
- -
-
-

Example:

-

HTML:

- - + + + Demo + +

Change Event:

+
+

Page Size: {{event2?.pageSize || '100'}}

+

Page: {{event2?.page || '1'}} of {{event2?.maxPage || '14'}}

+

Rows: {{event2?.fromRow || '1'}} to {{event2?.toRow || '100'}}

+
+

Total: {{event2?.total || '1345'}}

+
+ + Row per page: - { {pagingBar.range} } of { {pagingBar.total} } + {{pagingBar2.range}} of {{pagingBar2.total}} +

Go to:

+ + +
- ]]> -
-

Typescript:

- - + + Code + +

HTML:

+ + + Row per page: + { {pagingBar.range} } of { {pagingBar.total} } +

Go to:

+ + + +
+ ]]> + +

Typescript:

+ + - -

Setup:

-

Import the [CovalentPagingModule] in your NgModule:

- - - - + export class Demo { + event: IPageChangeEvent; + + change(event: IPageChangeEvent): void { + this.event = event; + } + } + ]]> + + + + + + \ No newline at end of file diff --git a/src/app/components/components/paging/paging.component.ts b/src/app/components/components/paging/paging.component.ts index 47caf600ec..87399286c0 100644 --- a/src/app/components/components/paging/paging.component.ts +++ b/src/app/components/components/paging/paging.component.ts @@ -14,56 +14,18 @@ export class PagingDemoComponent { @HostBinding('@routeAnimation') routeAnimation: boolean = true; @HostBinding('class.td-route-animation') classAnimation: boolean = true; - - pagingBarAttrs: Object[] = [{ - description: `Array that populates page size menu. Defaults to [50, 100, 200, 500, 1000]`, - name: 'pageSizes?', - type: 'number[]', - }, { - description: `Shows or hides the first and last page buttons of the paging bar. Defaults to 'false'`, - name: 'firstLast?', - type: 'boolean', - }, { - description: `Shows or hides the 'all' menu item in the page size menu. Defaults to 'false'`, - name: 'pageSizeAll?', - type: 'boolean', - }, { - description: `Text for the 'all' menu item in the page size menu. Defaults to 'All'`, - name: 'pageSizeAllText?', - type: 'boolean', - }, { - description: `Selected page size for the pagination. Defaults to first element of the [pageSizes] array.`, - name: 'pageSize?', - type: 'number', - }, { - description: `Defines the number of PageLinks to display. PageLinks are used to jump to a specific page, default is 0.`, - name: 'pageLinkCount?', - type: 'number', - }, { - description: `ets starting page for the paging bar. Defaults to '1'`, - name: 'initialPage?', - type: 'number', - }, { - description: `Total rows for the pagination.`, - name: 'total', - type: 'number', - }, { - description: `Method to be executed when page size changes or any button is clicked in the paging bar.`, - name: 'change', - type: 'function($event: IPageChangeEvent)', - }, { - description: `Navigates to a specific valid page. - Returns 'true' if page is valid, else 'false'.`, - name: 'navigateToPage', - type: 'function(page: number): boolean', - }]; - - event: IPageChangeEvent; + + event1: IPageChangeEvent; + event2: IPageChangeEvent; firstLast: boolean = false; pageSizeAll: boolean = false; - change(event: IPageChangeEvent): void { - this.event = event; + change1(event: IPageChangeEvent): void { + this.event1 = event; + } + + change2(event: IPageChangeEvent): void { + this.event2 = event; } toggleFirstLast(): void { diff --git a/src/platform/core/paging/README.md b/src/platform/core/paging/README.md index a2d3fc7b06..caec4c1e07 100644 --- a/src/platform/core/paging/README.md +++ b/src/platform/core/paging/README.md @@ -4,7 +4,7 @@ The `(change)` event throws an event with the following interface: -```typscript +```typescript export interface IPageChangeEvent { page: number; maxPage: number; @@ -51,10 +51,43 @@ export class MyModule {} Example for HTML usage: - ```html - +```html + + Row per page: + {{pagingBar.range}} of {{pagingBar.total}} + +``` + +Example with material input for `Go to` usage: + +```html + Row per page: {{pagingBar.range}} of {{pagingBar.total}} +

Go to:

+ + +
- ``` +``` diff --git a/src/platform/core/paging/paging-bar.component.html b/src/platform/core/paging/paging-bar.component.html index f1e59a98a8..8d6dc6db51 100644 --- a/src/platform/core/paging/paging-bar.component.html +++ b/src/platform/core/paging/paging-bar.component.html @@ -1,4 +1,4 @@ -
+
@@ -8,9 +8,7 @@ {{pageSizeAllText}} -
- -
+