Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

Commit 1adc131

Browse files
committed
Removed table info, added method for get the pager
1 parent aa56829 commit 1adc131

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

src/utils/DatasourceUtils.js

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default {
2626
changePage (page) {
2727
this.selected = null
2828
this.indexSelected = -1
29-
this.pagination.current_page = page
29+
this.current_page = page
3030
this.$emit('change', { perpage: this.perpage, page: page })
3131
},
3232

@@ -50,50 +50,40 @@ export default {
5050
}
5151
},
5252

53-
/**
54-
* Computed property: Building custom string information with translation
55-
* @returns {String}
56-
*/
57-
tableInfo () {
58-
let labelShow = this.translation.pagination.show
59-
let from = (this.pagination.from === null) ? 0 : this.pagination.from
60-
let labelTo = this.translation.pagination.to
61-
let to = (this.pagination.to === null) ? 0 : this.pagination.to
62-
let labelOf = this.translation.pagination.of
63-
let total = this.pagination.total
64-
let labelEntries = this.translation.pagination.entries
65-
return `${labelShow} ${from} ${labelTo} ${to} ${labelOf} ${total} ${labelEntries}`
66-
},
67-
6853
/**
6954
* Computed property: Build custom array with the pagination items
7055
* @return Array
7156
*/
7257
gettingItems () {
7358
let temp = []
74-
let bottomLimit = this.pages.current_page - 2
75-
let topLimit = this.pages.current_page + 2
59+
let bottomLimit = this.currentPage - 2
60+
let topLimit = this.currentPage + 2
7661
let showing = 5
7762
if (bottomLimit <= 0) {
7863
bottomLimit = 1
7964
topLimit = 5
8065
}
81-
if (topLimit >= this.pages.last_page) {
82-
bottomLimit = this.pages.last_page - 4
83-
topLimit = this.pages.last_page
66+
if (topLimit >= this.lastPage) {
67+
bottomLimit = this.lastPage - 4
68+
topLimit = this.lastPage
8469
}
85-
if (this.pages.last_page < 5) {
86-
showing = this.pages.last_page
70+
if (this.lastPage < 5) {
71+
showing = this.lastPage
8772
}
8873
if (bottomLimit <= 0) {
8974
bottomLimit = 1
9075
}
91-
if (this.pages.last_page === 0 || this.pages.last_page === 1) {
76+
if (this.lastPage === 0 || this.lastPage === 1) {
9277
showing = 1
9378
}
9479
for (let i = 0; i < showing; i++) {
9580
temp[i] = i + bottomLimit
9681
}
9782
return temp
83+
},
84+
85+
roundNumber (value, precision) {
86+
let multiplier = Math.pow(10, precision || 0)
87+
return Math.round(value * multiplier) / multiplier
9888
}
9989
}

0 commit comments

Comments
 (0)