From 71c9427dbca04653be3b1d56419cf0ce43efb5b8 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Thu, 21 Mar 2019 11:04:44 +0300 Subject: [PATCH] Finished paginator docs and added image gallery demo --- src/views/paginator/PaginatorDemo.vue | 26 ++++++++--- src/views/paginator/PaginatorDoc.vue | 67 ++++++++++++++++++--------- 2 files changed, 64 insertions(+), 29 deletions(-) diff --git a/src/views/paginator/PaginatorDemo.vue b/src/views/paginator/PaginatorDemo.vue index 641bab436..b3185d0ae 100644 --- a/src/views/paginator/PaginatorDemo.vue +++ b/src/views/paginator/PaginatorDemo.vue @@ -12,14 +12,18 @@

Custom Template

- + + + @@ -36,14 +40,17 @@ export default { rows: 10, totalRecords: 50, first2: 0, - rows2: 1, - totalRecords2: 12 + totalRecords2: 12, + image: 'nature1' } }, methods: { onPageChangeCustom(event) { - this.first2 = event.first; - this.rows2 = event.rows; + this.image = 'nature' + (event.page + 1); + }, + reset() { + this.first2 = 0; + this.image = 'nature1'; } }, components: { @@ -52,8 +59,13 @@ export default { } - \ No newline at end of file diff --git a/src/views/paginator/PaginatorDoc.vue b/src/views/paginator/PaginatorDoc.vue index 82ee81612..e113b9c0a 100644 --- a/src/views/paginator/PaginatorDoc.vue +++ b/src/views/paginator/PaginatorDoc.vue @@ -77,7 +77,6 @@ onPage(event) { //event.page: New page number //event.first: Index of first record //event.rows: Number of rows to display in new page - //event.page: Index of the new page //event.pageCount: Total number of pages } @@ -156,7 +155,6 @@ onPage(event) { event.page: New page number
event.first: Index of first record
event.rows: Number of rows to display in new page
- event.page: Index of the new page
event.pageCount: Total number of pages Callback to invoke when page changes, the event object contains information about the new state. @@ -222,51 +220,76 @@ onPage(event) { <template> - <div> - <div class="content-section introduction"> - <div class="feature-intro"> - <h1>Paginator</h1> - <p>Paginator is a generic component to display content in paged format.</p> - </div> - </div> + <div> + <div class="content-section introduction"> + <div class="feature-intro"> + <h1>Paginator</h1> + <p>Paginator is a generic component to display content in paged format.</p> + </div> + </div> - <div class="content-section implementation"> - <h3 class="first">Default</h3> - <Paginator :first.sync="first" :rows.sync="rows" :totalRecords="totalRecords" :rowsPerPageOptions="[10,20,30]"></Paginator> + <div class="content-section implementation"> + <h3 class="first">Default</h3> + <Paginator :first.sync="first" :rows.sync="rows" :totalRecords="totalRecords" :rowsPerPageOptions="[10,20,30]"></Paginator> - <h3>Custom Template</h3> - <Paginator :first="first2" :rows="rows2" :totalRecords="totalRecords2" @page-change="onPageChangeCustom($event)" template="FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"> + <h3>Custom Template</h3> + <Paginator :first.sync="first2" :rows="1" :totalRecords="totalRecords2" @page-change="onPageChangeCustom($event)" template="FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"> <template #left> - <Button type="button" icon="pi pi-refresh" /> + <Button type="button" icon="pi pi-refresh" @click="reset()"/> </template> <template #right> <Button type="button" icon="pi pi-search" /> </template> </Paginator> - </div> - </div> + + <div class="image-gallery"> + <img :src="'/demo/images/nature/' + image + '.jpg'" /> + </div> + </div> + + <PaginatorDoc /> + </div> </template> +import PaginatorDoc from './PaginatorDoc'; + export default { data() { return { - first: 0, + first: 0, rows: 10, totalRecords: 50, first2: 0, - rows2: 1, - totalRecords2: 12 + totalRecords2: 12, + image: 'nature1' } }, methods: { onPageChangeCustom(event) { - this.first2 = event.first; - this.rows2 = event.rows; + this.image = 'nature' + (event.page + 1); + }, + reset() { + this.first2 = 0; + this.image = 'nature1'; } + }, + components: { + 'PaginatorDoc': PaginatorDoc } } + + + +.p-button.p-button-icon-only { + border-radius: 0; +} + +.image-gallery { + text-align: center; + padding: 1em; +}