widgetti / widgetti/ipyvuetify
ipyvuetify DatePicker and allowedDates
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
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 ?)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DatesPicker example in the issue, including the allowedDatesArray traitlet, the VuetifyTemplate _template, and the allowedDates method. Check how values synchronized from Python can be accessed by the template method. Done means the date picker accepts the Python date list and permits only those dates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100