Selection in MultiViewCalendar with custom cell

2 Answers 58 Views
Calendar MultiViewCalendar
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Bernd asked on 01 Aug 2023, 08:31 AM

Hi.

In your documentation example of the MultiViewCalendar on this page you write "For the custom cell to allow date selection, manually pass or handle the onClick event".

In the code of the example the onClick event is handled in the CustomCell component but still nothing happens if I click on a date that should be a valid selection. I tried it out myself in my code and it doesn't work. Isn't the "handleClick" method in the CustomCell component enough to handle the onClick event?

And another question: Is it also possible to allow to select more than one day in the Calendar component?

Thanks,

Greetings,

Bernd

2 Answers, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 02 Aug 2023, 12:13 PM

Hi Bernd,

It seems that the example does not work correctly with the latest version and it will need some modification. In regards of the onClick, you need to pass the TD onClick event as well:

You will notice that a "k-calendar-td" class needs to be added as well to the TD element:

    className={'k-calendar-td ' + className}

As for the question about the Calendar, I have to say that there is no built-in option for multiple selection. It might be possible to handle the onClick of the custom cell to gather all clicked dates and store it them in a state variable. Then, within the rendering of the custom cells you can use that array to visualize the selection. 

 

Best Regards,
Konstantin Dikov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
commented on 03 Aug 2023, 09:13 AM

Hi.

Thanks for your answer.

That works.


0
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 03 Aug 2023, 09:16 AM

If somebody is looking for this:

I have forked the solution above and changed it so that multi selection of days in the MultiViewCalendar with a custom cell is possible.

Maybe not the nicest example but it works:

https://stackblitz.com/edit/react-wgnhmt-2uwz2s?file=app%2Fmain.jsx

 

Konstantin Dikov
Telerik team
commented on 05 Aug 2023, 02:14 PM

Hi Bernd,

Thank you for sharing the solution with the community.

I saw that you have opened a feature request as well with the temporary workaround.

For sharing your solution I have updated your Telerik Points accordingly.

Best Regards! 

Tags
Calendar MultiViewCalendar
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Konstantin Dikov
Telerik team
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Share this question
or