From 4c9dbbd2fb9a6334af33e9aff0517d67614c7ddb Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Thu, 30 Jan 2020 13:42:35 +0300 Subject: [PATCH] New demo for the default datatable --- src/components/datatable/DataTable.vue | 1 + src/views/datatable/DataTableDemo.vue | 165 ++++++++++++++++++++----- src/views/datatable/DataTableDoc.vue | 165 ++++++++++++++++++++----- 3 files changed, 271 insertions(+), 60 deletions(-) diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index 506c87d40..f3fcac5d0 100644 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -1818,6 +1818,7 @@ export default { .p-datatable .p-column-title { user-select: none; + vertical-align: middle; } .p-datatable .p-sortable-column { diff --git a/src/views/datatable/DataTableDemo.vue b/src/views/datatable/DataTableDemo.vue index cef38d44f..f9fe8ac18 100644 --- a/src/views/datatable/DataTableDemo.vue +++ b/src/views/datatable/DataTableDemo.vue @@ -10,27 +10,73 @@
-

Basic

- - - - - - - -

Dynamic Columns

- - - - -

Styled

- - - - - + + + + + + + + + + + + + + + + + + + + + + +
@@ -48,23 +94,39 @@ import DataTableDoc from './DataTableDoc'; export default { data() { return { - columns: null, - cars: null + cars: null, + selectedCar: null, + filters: {}, + brands: [ + {brand: 'Audi', value: 'Audi'}, + {brand: 'BMW', value: 'BMW'}, + {brand: 'Fiat', value: 'Fiat'}, + {brand: 'Honda', value: 'Honda'}, + {brand: 'Jaguar', value: 'Jaguar'}, + {brand: 'Mercedes', value: 'Mercedes'}, + {brand: 'Renault', value: 'Renault'}, + {brand: 'Volkswagen', value: 'Volkswagen'}, + {brand: 'Volvo', value: 'Volvo'} + ], + colors: [ + {name: 'White', value: 'White'}, + {name: 'Green', value: 'Green'}, + {name: 'Silver', value: 'Silver'}, + {name: 'Black', value: 'Black'}, + {name: 'Red', value: 'Red'}, + {name: 'Maroon', value: 'Maroon'}, + {name: 'Brown', value: 'Brown'}, + {name: 'Orange', value: 'Orange'}, + {name: 'Blue', value: 'Blue'} + ] } }, carService: null, created() { this.carService = new CarService(); - - this.columns = [ - {field: 'vin', header: 'Vin'}, - {field: 'year', header: 'Year'}, - {field: 'brand', header: 'Brand'}, - {field: 'color', header: 'Color'} - ]; }, mounted() { - this.carService.getCarsSmall().then(data => this.cars = data); + this.carService.getCarsLarge().then(data => this.cars = data); }, components: { 'DataTableDoc': DataTableDoc, @@ -74,12 +136,55 @@ export default {