11<script >
22import DatasourceUtils from ' ../utils/DatasourceUtils'
3- import Pagination from ' ./Pagination.vue '
3+ import Pagination from ' ./Pagination'
44import {EventBus } from ' ../utils/EventBus'
55export default {
66 name: ' ServerDatasource' ,
@@ -32,9 +32,6 @@ export default {
3232 < / thead>
3333 < tbody>
3434 {this .columnObjects }
35- < tr>
36- < td class = " text-center warning" colspan= {this .columns .length }> {this .tableInfo }< / td>
37- < / tr>
3835 < / tbody>
3936 < / table>
4037 < / div>
@@ -43,7 +40,7 @@ export default {
4340 {this .actionsObject }
4441 < / div>
4542 < div class = " pull-right" >
46- < pagination pages = {this .pagination }>< / pagination>
43+ < pagination total = {this .total } per - page = { this . perpage }>< / pagination>
4744 < / div>
4845 < div class = " clearfix" >< / div>
4946 < / div>
@@ -60,6 +57,14 @@ export default {
6057 type: Array ,
6158 required: true
6259 },
60+ /**
61+ * Total of items
62+ * @type {Number}
63+ */
64+ total: {
65+ type: Number ,
66+ required: true
67+ },
6368 /**
6469 * Limits to display
6570 * @type {Array}
@@ -116,16 +121,10 @@ export default {
116121 data () {
117122 return {
118123 perpage: 10 ,
124+ current_page: 1 ,
119125 selected: null , // row and Object selected on click event
120126 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,
129128 }
130129 },
131130 computed: {
@@ -166,8 +165,7 @@ export default {
166165 console .warn (` [VueDatasource] The callback show is not defined in action ${ action .text } .` )
167166 }
168167 })
169- },
170- tableInfo: DatasourceUtils .tableInfo
168+ }
171169 },
172170 methods: {
173171 fetchFromObject: DatasourceUtils .fetchFromObject ,
@@ -182,7 +180,7 @@ export default {
182180 searching (e ) {
183181 this .selected = null
184182 this .indexSelected = - 1
185- this .pagination . current_page = 1
183+ this .current_page = 1
186184 this .$emit (' searching' , e .target .value )
187185 }
188186 },
@@ -194,7 +192,7 @@ export default {
194192 perpage () {
195193 this .selected = null
196194 this .indexSelected = - 1
197- this .pagination . current_page = 1
195+ this .current_page = 1
198196 this .$emit (' change' , {perpage: this .perpage , page: 1 })
199197 },
200198 source () {
0 commit comments