11<template >
2- <v-container class =" fill-height" >
3- <v-responsive
4- class =" align-centerfill-height mx-auto"
5- max-width =" 900"
6- >
7- <v-row >
8- <v-col cols =" 12" >
9- <v-form >
10- <v-text-field
11- v-model =" form.search"
12- label =" search"
13- />
14- <v-checkbox
15- v-model =" form.is_answered"
16- label =" is Answered"
17- />
18- </v-form >
19- </v-col >
20- </v-row >
21- <v-row >
22- <v-col cols =" 12" >
23- <v-card
24- class =" py-4"
25- rounded =" lg"
26- variant =" outlined"
27- >
28- <template #text >
29- <v-data-table
30- :items =" items"
31- :page =" vuetifyOptions.page"
32- :items-per-page =" vuetifyOptions.itemsPerPage"
33- :sort-by =" vuetifyOptions.sortBy"
34- v-model:options =" vuetifyOptions"
35- />
36- </template >
37- </v-card >
38- </v-col >
39- </v-row >
40- </v-responsive >
41- </v-container >
2+ <v-row >
3+ <v-col cols =" 12" >
4+ <v-form >
5+ <v-text-field
6+ v-model =" form.search"
7+ label =" search"
8+ />
9+ <v-checkbox
10+ v-model =" form.is_answered"
11+ label =" is Answered"
12+ />
13+ </v-form >
14+ </v-col >
15+ </v-row >
16+ <v-row >
17+ <v-col cols =" 12" >
18+ <v-card
19+ class =" py-4"
20+ rounded =" lg"
21+ variant =" outlined"
22+ >
23+ <template #text >
24+ <v-data-table
25+ v-model:options =" vuetifyOptions"
26+ :items =" items"
27+ :page =" vuetifyOptions.page"
28+ :items-per-page =" vuetifyOptions.itemsPerPage"
29+ :sort-by =" vuetifyOptions.sortBy"
30+ />
31+ </template >
32+ </v-card >
33+ </v-col >
34+ </v-row >
4235</template >
4336
4437<script setup lang="ts">
4538import { ref } from ' vue' ;
4639import useDatatableUrlSync from ' ../../../src/useDatatableUrlSync' ;
47- import type { GenericDictionnary , VDUSDatatableOptions , VDUSFormSchema } from ' ../../../src/utils/VDUSTypes' ;
40+ import type { GenericDictionnary , VDUSDatatableOptions , VDUSFormSchema , VDUSConfiguration } from ' ../../../src/utils/VDUSTypes' ;
4841// import useDatatableUrlSync from 'vue-datatable-url-sync';
4942// import type { GenericDictionnary, VDUSDatatableOptions, VDUSFormSchema } from 'vue-datatable-url-sync/src/utils/VDUSTypes';
5043import fakeData from " ../assets/data/data.js" ;
@@ -56,6 +49,14 @@ type FakeDataItem = {
5649 is_answered: boolean ;
5750};
5851
52+ // --------------------- PROPS ------------------------------------
53+ const props = defineProps ({
54+ prefix: {
55+ type: String ,
56+ default: " "
57+ },
58+ })
59+
5960// --------------------- DATA ------------------------------------
6061const form = ref <GenericDictionnary >({
6162 search: " " ,
@@ -68,10 +69,15 @@ const options = ref<VDUSDatatableOptions>({
6869 ordering: []
6970});
7071
72+ const configurations = ref <VDUSConfiguration >({
73+ prefix: props .prefix ,
74+ serveurDefaultPageSize: 10 ,
75+ })
76+
7177const items = ref <FakeDataItem []>([]);
7278
7379const formSchema = ref <VDUSFormSchema >({
74- is_answered: { type: " boolean" }
80+ is_answered: { type: " boolean" },
7581});
7682
7783// --------------------- METHODS ------------------------------------
@@ -121,5 +127,5 @@ const fetchDatas = (queryParams: string, queryAsObject: GenericDictionnary) => {
121127};
122128
123129// --------------------- CREATED ------------------------------------
124- const {vuetifyOptions} = useDatatableUrlSync (useRoute (), useRouter (), form , fetchDatas , options , formSchema .value );
130+ const {vuetifyOptions} = useDatatableUrlSync (useRoute (), useRouter (), form , fetchDatas , options , formSchema .value , null , configurations . value );
125131 </script >
0 commit comments