Closed baleeds closed 3 years ago
Hello @baleeds , The igxCalendar is not supporting two way data binding for deselection of dates by specification. In addition this component exposes 'deselectDate' method for this purposes which ensures the correct deselection based on disabled dates and other scenarios. In the provided sample you can achieve this functionality by using it and all dates will be synced with the calendar.
Thanks for the response. That solution will work for me 👍
Have you considered supporting full two-way binding? I feel it would be more consistent with other form controls in the IGX library, and in Angular as a whole.
If not, I would suggest that some changes be made to the documentation which outlines this information. Not using two-way binding to interact with a form control in Angular is a deviation from the pattern. Being able to do one-way binding with ngModel
makes this even more confusing.
Thanks again, it's a great component!
@baleeds, Thank you for the feedback, we really appreciate it and will take it into account! We will update our current documentation and will discuss if it's possible to introduce two-way data binding as a new feature in one of our upcoming major versions.
Description
Two-way data binding
[(ngModel)]
doesn't work properly with the igx-calendar component in multi-selection mode. Additionally, setting theIgxCalendarComponent.value
manually does nothing to update the internal state of selected dates.Steps to reproduce
Here is a minimum example of the bug on StackBlitz 1) Using the linked stackblitz, select three dates on the calendar. The dates will appear below. 2) Click the "clear dates" button. Notice the dates are still selected on the calendar, even though the dates property is now empty. 3) Click another date on the calendar. Notice the dates property now contains all 4 dates that have ever been selected.
Result
The dates property is not being synced to the selected dates on the calendar.
Expected result
The calendar's dates should match the dates property.