ipyvuetify
ipyvuetify copied to clipboard
ipyvuetify DatePicker and allowedDates
I m struggling with the datePicker widget, I have a list of dates in python and I would like to display the widget with only theses dates, but how I m supposed to provide that array with ipyvuetify ?
This work fine, but it only hides odd days.
class DatesPicker(v.VuetifyTemplate):
date = traitlets.Unicode(default_value= '2020-01-01').tag(sync=True)
#allowedDatesArray = traitlets.List(default_value= ["2020-01-01","2020-01-02", "2020-01-05","2020-01-06"]).tag(sync=True)
traitlets.default('template')
def _template(self):
'''<template>
<v-row justify="center">
<v-date-picker
v-model="date"
:allowed-dates="allowedDates"
class="mt-4"
min="2016-06-15"
max="2020-01-15"
></v-date-picker>
</v-row>
</template>
<script >
export default {
data: () => ({
}),
methods: {
allowedDates: val => parseInt(val.split('-')[2], 10) % 2 === 0,
},
}
</script>
''' So how can I pass "allowedDatesArray" to methods, or is there an other way to deal with allowedDates based on an array ? (With trailets only ?)
UP! How can I link python's list of allowed-dates ?