Need Calendar with multiselect without press ctrlKey, allway add or remove date from array
Hi Konstantin,
My name is Nikolay and I will be the owner of this thread until my colleague Viktor returns.
I can definitely see the value of implementing this feature and so I have transferred this thread to our feedback portal so people can upvote it. Here it will be reviewed by Product Management for future planning and implementation. The items which gain a lot of popularity are acted upon and included in the RoadMap:
Let me know if you have any questions.
Regards,
Nikolay
Progress Telerik
Syncfusion has it on their multi select control, can you guys at it to Asp.Net core for us?
Please, change in link: https://docs.telerik.com/kendo-ui/knowledge-base/calendar-select-dates-click
Instead of:
var clickedDateString = clickedItem.children("a")[0].title;
var clickedDate = new Date(clickedDateString);
This:
var clickedDate = kendo.calendar.toDateObject(clickedItem.children("a"))
And add:
calendar.trigger('change');
Hello Viktor,
Sorry, I missed it
$('#calendar').data('kendoCalendar').selectWithoutCtrlKey();
The function call for the calendar is more convenient
Hello Viktor,
Thanks, but this not work, i am change function:
kendo.ui.Calendar.prototype.selectWithoutCtrlKey = function() {
var me = this;
this.element.on("mousedown",
"td",
function(e) {
// get item if the user clicked on an item template
var clickedItem = $(e.target).closest("td[role='gridcell']");
// prevent click event for item elements
// todo: think about multiple add event
clickedItem.on("click",
function(e) {
e.stopPropagation();
e.preventDefault();
});
if (clickedItem.length > 0) {
var clickedDate = me._toDateObject(clickedItem.children("a"));
var selectedDates = me.selectDates();
if (clickedItem.hasClass("k-state-selected")) {
// if date is already selected - remove it from collection
selectedDates = $.grep(selectedDates,
function(item, index) {
return clickedDate.getTime() !== item.getTime();
});
} else {
selectedDates.push(clickedDate);
}
me.selectDates(selectedDates);
me.trigger('change');
}
});
};