tethys/resources/js/components/MyVuetable.vue

107 lines
2.6 KiB
Vue
Raw Permalink Normal View History

2018-09-07 13:31:05 +00:00
// MyVuetable.vue
2018-09-10 13:09:10 +00:00
<!-- :fields="['name', 'email', 'birthdate']" -->
// "https://vuetable.ratiw.net/api/users"
2018-09-07 13:31:05 +00:00
<template>
<vuetable ref="vuetable"
2018-09-10 13:09:10 +00:00
api-url="/api/persons"
v-bind:fields="fields" pagination-path=""
2018-09-11 14:36:19 +00:00
v-bind:css="css.table"
2018-09-07 13:31:05 +00:00
></vuetable>
</template>
<script>
import Vuetable from "vuetable-2/src/components/Vuetable";
2018-09-11 14:36:19 +00:00
import VuetablePagination from 'vuetable-2/src/components/VuetablePagination'
import VuetablePaginationInfo from 'vuetable-2/src/components/VuetablePaginationInfo'
import CustomActions from './CustomActions'
Vue.component('custom-actions', CustomActions)
2018-09-07 13:31:05 +00:00
export default {
components: {
2018-09-11 14:36:19 +00:00
Vuetable,
VuetablePagination,
VuetablePaginationInfo,
2018-09-10 13:09:10 +00:00
},
data() {
return {
fields: [
{
name: "full_name",
2018-09-11 08:05:25 +00:00
// sortField: "full_name"
2018-09-10 13:09:10 +00:00
},
{
name: "email",
2018-09-11 08:05:25 +00:00
sortField: "email"
2018-09-10 13:09:10 +00:00
},
{
name: "date_of_birth",
2018-09-11 08:05:25 +00:00
sortField: "date_of_birth",
2018-09-10 13:09:10 +00:00
// titleClass: "text-center",
// dataClass: "text-center",
// callback: "formatDate|DD-MM-YYYY"
},
{
name: "__component:custom-actions",
title: "Actions",
2018-09-11 14:36:19 +00:00
// titleClass: "text-center",
// dataClass: "text-center"
2018-09-10 13:09:10 +00:00
}
],
css: {
table: {
2018-09-11 14:36:19 +00:00
tableClass: "table pure-table pure-table-horizontal",
2018-09-10 13:09:10 +00:00
ascendingIcon: "glyphicon glyphicon-chevron-up",
descendingIcon: "glyphicon glyphicon-chevron-down"
2018-09-11 14:36:19 +00:00
},
2018-09-10 13:09:10 +00:00
icons: {
first: "glyphicon glyphicon-step-backward",
prev: "glyphicon glyphicon-chevron-left",
next: "glyphicon glyphicon-chevron-right",
last: "glyphicon glyphicon-step-forward"
}
},
sortOrder: [{ field: "email", sortField: "email", direction: "asc" }],
moreParams: {}
};
2018-09-11 14:36:19 +00:00
}//data end
2018-09-07 13:31:05 +00:00
};
2018-09-11 14:36:19 +00:00
</script>
<style>
.pagination {
margin: 0;
float: right;
}
.pagination a.page {
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 10px;
margin-right: 2px;
}
.pagination a.page.active {
color: white;
background-color: #337ab7;
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 10px;
margin-right: 2px;
}
.pagination a.btn-nav {
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 7px;
margin-right: 2px;
}
.pagination a.btn-nav.disabled {
color: lightgray;
border: 1px solid lightgray;
border-radius: 3px;
padding: 5px 7px;
margin-right: 2px;
cursor: not-allowed;
}
.pagination-info {
float: left;
}
</style>