1
1
<script >
2
2
import DatasourceUtils from ' ../utils/DatasourceUtils'
3
- import Pagination from ' ./Pagination.vue '
3
+ import Pagination from ' ./Pagination'
4
4
import {EventBus } from ' ../utils/EventBus'
5
5
export default {
6
6
name: ' ServerDatasource' ,
@@ -32,9 +32,6 @@ export default {
32
32
< / thead>
33
33
< tbody>
34
34
{this .columnObjects }
35
- < tr>
36
- < td class = " text-center warning" colspan= {this .columns .length }> {this .tableInfo }< / td>
37
- < / tr>
38
35
< / tbody>
39
36
< / table>
40
37
< / div>
@@ -43,7 +40,7 @@ export default {
43
40
{this .actionsObject }
44
41
< / div>
45
42
< div class = " pull-right" >
46
- < pagination pages = {this .pagination }>< / pagination>
43
+ < pagination total = {this .total } per - page = { this . perpage }>< / pagination>
47
44
< / div>
48
45
< div class = " clearfix" >< / div>
49
46
< / div>
@@ -60,6 +57,14 @@ export default {
60
57
type: Array ,
61
58
required: true
62
59
},
60
+ /**
61
+ * Total of items
62
+ * @type {Number}
63
+ */
64
+ total: {
65
+ type: Number ,
66
+ required: true
67
+ },
63
68
/**
64
69
* Limits to display
65
70
* @type {Array}
@@ -116,16 +121,10 @@ export default {
116
121
data () {
117
122
return {
118
123
perpage: 10 ,
124
+ current_page: 1 ,
119
125
selected: null , // row and Object selected on click event
120
126
indexSelected: - 1 , // index row selected on click event
121
- search: ' ' , // word to search in the table,
122
- pagination: {
123
- total: 0 ,
124
- to: 0 ,
125
- from: 0 ,
126
- per_page: 10 ,
127
- current_page: 1
128
- }
127
+ search: ' ' // word to search in the table,
129
128
}
130
129
},
131
130
computed: {
@@ -166,8 +165,7 @@ export default {
166
165
console .warn (` [VueDatasource] The callback show is not defined in action ${ action .text } .` )
167
166
}
168
167
})
169
- },
170
- tableInfo: DatasourceUtils .tableInfo
168
+ }
171
169
},
172
170
methods: {
173
171
fetchFromObject: DatasourceUtils .fetchFromObject ,
@@ -182,7 +180,7 @@ export default {
182
180
searching (e ) {
183
181
this .selected = null
184
182
this .indexSelected = - 1
185
- this .pagination . current_page = 1
183
+ this .current_page = 1
186
184
this .$emit (' searching' , e .target .value )
187
185
}
188
186
},
@@ -194,7 +192,7 @@ export default {
194
192
perpage () {
195
193
this .selected = null
196
194
this .indexSelected = - 1
197
- this .pagination . current_page = 1
195
+ this .current_page = 1
198
196
this .$emit (' change' , {perpage: this .perpage , page: 1 })
199
197
},
200
198
source () {
0 commit comments