motss / app-datepicker

Datepicker element built with Google's lit and Material Design 2021
https://npm.im/app-datepicker
MIT License
180 stars 51 forks source link

Dynamic Date pickers #111

Closed ranjitjitu closed 6 years ago

ranjitjitu commented 6 years ago

how do i create multiple app-datepicker-dialog on dom-repeat with a paper-button attached to each instance of app-datepicker-dialog and fetch the value of each app-datepicker-dialog when selected?

motss commented 6 years ago

Any reduced test case to help understand your use case?

ranjitjitu commented 6 years ago

Well I need to create a group of user defined holiday list which will include name of the holiday and the date(planning to app-datepicker) and there will be a add button attached with each group on click of which it will create a clone of the holiday name element and calender element and add button again. I hope I was able to clarify my use case in a proper way.

motss commented 6 years ago

@ranjitjitu Based on your use case, I see no need to have a group of <app-datepicker-dialog>. What I would do is to update the date of a <app-datepicker-dialog> when the user clicks on one of the holidays in the list. This means that each and every holiday in the list should have some kind of way to preserve its date value, even for any date change that is triggered by the user.

In such way, you are benefited from having only one element rendered on the page and reuse that same <app-datepicker-dialog> for displaying and updating dates. I'd imagine the number of elements you need to render scale maybe linearly with your holiday list which will eventually lead to serious performance issue on the browser.

Hope this helps.

ranjitjitu commented 6 years ago

Thanks for the response..will try it out

motss commented 6 years ago

Closing this.