2525 <table class =" table table-striped Vue__table" >
2626 <thead >
2727 <tr >
28+ <!-- columns-->
2829 <th v-for =" column in columns" >{{ column.name }}</th >
30+ <!-- /columns-->
2931 </tr >
3032 </thead >
3133 <tbody >
3234 <tr v-if =" pagination.total == 0" >
3335 <td :colspan =" columns.length" >{{ translation.table.records_not_found }}</td >
3436 </tr >
37+ <!-- rows-->
3538 <tr v-else
3639 :class =" { 'success': (index == indexSelected) }"
3740 v-for =" (row, index) in tableData"
4043 {{ fetchFromObject(row, k.key, k.render) }}
4144 </td >
4245 </tr >
46+ <!-- /rows-->
4347 <tr >
48+ <!-- info-table-->
4449 <td class =" text-center" :colspan =" columns.length" >
4550 {{ tableInfo }}
4651 </td >
52+ <!-- /info-table-->
4753 </tr >
4854 </tbody >
4955 </table >
5056 </div >
5157 <div class =" panel-footer Vue__panel-footer" >
5258 <div class =" pull-left" >
59+ <!-- actions-buttons-->
5360 <div class =" btn-group Vue__datasource_actions" >
5461 <button class =" btn btn-default" type =" button"
5562 :class =" btn.class"
5966 {{ btn.text }}
6067 </button >
6168 </div >
69+ <!-- /actions-buttons-->
6270 </div >
6371 <div class =" pull-right" >
64- <pagination
65- :pages =" pagination"
66- @change =" changePage"
67- :translation =" translation.pagination" ></pagination >
72+ <!-- pagination-->
73+ <pagination :pages =" pagination" :translation =" translation.pagination" @change =" changePage" ></pagination >
74+ <!-- /pagination-->
6875 </div >
6976 <div class =" clearfix" ></div >
7077 </div >
8188 Pagination
8289 },
8390 props: {
91+ /**
92+ * The table information to display
93+ * @type {Array}
94+ */
8495 tableData: {
8596 type: Array ,
8697 required: true
8798 },
99+ /**
100+ * Defines the language with which the table will be displayed
101+ * @type {String}
102+ */
88103 language: {
89104 type: String ,
90105 default: ' es'
91106 },
107+ /**
108+ * Columns to display in table
109+ * @type {Array}
110+ */
92111 columns: {
93112 type: Array ,
94113 required: true
95114 },
115+ /**
116+ * Information about data collection to paginate
117+ * @type {Object}
118+ */
96119 pagination: {
97120 type: Object ,
98121 default () {
104127 }
105128 }
106129 },
130+ /**
131+ * Buttons to perform action on click event
132+ * @type {Array}
133+ */
107134 actions: {
108135 type: Array ,
109136 default () {
113140 },
114141 data () {
115142 return {
116- limits: [1 , 5 , 10 , 15 , 20 ],
117- perpage: 15 ,
118- selected: null ,
119- indexSelected: - 1 ,
120- search: ' '
143+ limits: [1 , 5 , 10 , 15 , 20 ], // values that the user can select to display records
144+ perpage: 15 , // default value to show records
145+ selected: null , // row and Object selected on click event
146+ indexSelected: - 1 , // index row selected on click event
147+ search: ' ' // word to search in the table
121148 }
122149 },
123150 computed: {
151+ /**
152+ * Get the translation to display in the table
153+ * @return {Object}
154+ */
124155 translation () {
125156 return Language .translations [this .language ];
126157 },
136167 }
137168 },
138169 watch: {
170+ /**
171+ * Event when the record limit to be displayed is changed
172+ * @return {void}
173+ */
139174 perpage () {
140175 this .selected = null ;
141176 this .$emit (' change' , { perpage: this .perpage , page: 1 });
145180 </script >
146181<style lang="sass" scoped>
147182 .vue-datasource {
148-
149183 .Vue__panel-body {
150184 padding : 0 ;
151185 .Vue__table {
152186 margin-bottom : 0 ;
153187 }
154188 }
155-
156189 .Vue__panel-footer {
157190 .Vue__datasource_actions {
158191 margin : 10px 0 ;
159192 }
160193 }
161-
162194 }
163195 </style >
0 commit comments