From 91d4ab43b31b8698add534f60b7239bab9641b41 Mon Sep 17 00:00:00 2001 From: Fabio Capucci Date: Fri, 4 Aug 2017 09:40:30 +0200 Subject: [PATCH 1/2] Table added support for backend pagination --- src/components/table/Table.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/table/Table.vue b/src/components/table/Table.vue index 07b7671f3..06a049762 100644 --- a/src/components/table/Table.vue +++ b/src/components/table/Table.vue @@ -116,7 +116,7 @@
'' + }, + backendPagination: Boolean, + total: { + type: [Number, String], + default: 0 } }, data() { @@ -179,6 +184,7 @@ columns: [], visibleDetailRows: [], newData: this.data, + newDataTotal: this.backendPagination ? this.total : this.data.length, newCheckedRows: [...this.checkedRows], currentSortColumn: {}, isAsc: true, @@ -192,12 +198,26 @@ /** * When data prop change, update internal value and sort again, * do not sort however if it's backend-sort. + * If it isn't backend-paginated set new total */ data(value) { this.newData = value if (!this.backendSorting) { this.sort(this.currentSortColumn, true) } + if (!this.backendPagination) { + this.newDataTotal = value.length + } + }, + + /** + * When Pagination total change, update internal total + * only if it's backend-paginated. + */ + total(newTotal) { + if (this.backendPagination) { + this.newDataTotal = newTotal + } }, /** From df5b3fb53445efcb6528de0c9bb1b0b1c44fcf7a Mon Sep 17 00:00:00 2001 From: Fabio Capucci Date: Mon, 7 Aug 2017 15:29:43 +0200 Subject: [PATCH 2/2] Fix requested changes --- src/components/table/Table.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/table/Table.vue b/src/components/table/Table.vue index 06a049762..dbed2520b 100644 --- a/src/components/table/Table.vue +++ b/src/components/table/Table.vue @@ -215,9 +215,9 @@ * only if it's backend-paginated. */ total(newTotal) { - if (this.backendPagination) { - this.newDataTotal = newTotal - } + if (!this.backendPagination) return + + this.newDataTotal = newTotal }, /**