Hi
I am trying to set break time like lunch,Tea time to restrict appointment for particular time. All works fine when I Set Major Tick to 60, but its not working properly when Setting Major ticks to 30.
This setting not apply between 3:30PM to 3:45PM when set MajorTick:30 (PFA the same)
My Code for this is as follows:-
function onDataBound(e) {
var scheduler = e.sender;
var slots = $('.k-scheduler-content td[role=gridcell]');
for (var i = 0; i < slots.length; i += 1) {
var currentSlot = $(slots[i]);
var slotData = scheduler.slotByElement(currentSlot);
var items = '';
$.each(BreakTimeList, function (i, item) {
//Trying to set it 3:00PM to 3:30PM and 3:30PM to 4:00 PM
//But this setting not apply between 3:30PM to 3:45PM when MajorTick set to 30
if ((slotData.startDate.getHours() >= 3 && slotData.startDate.getMinutes() >= 00)
&& (slotData.endDate.getHours() <= 3 && slotData.endDate.getMinutes() <= 30)) {
currentSlot.html('<i class="fa fa-stopwatch"></i>');
}
});
}
}
Regards
Pankaj
Hi Pankaj,
Could you please share a runnable Dojo demo where the problem is replicated? This will help me fully understand the case and allow me to investigate further.
Regards,
Nikolay
Hi Nikolay
Here is the Dojo Demo where problem can be easily identified. here OnDataBound and Edit events is not working as expected.
Regards
Pankaj
Hi Pankaj,
Thank you for the Dojo example.
To have the slot of 1:45 PM to 2:00 PM disabled for editing you need to make a correct check of the start and end time slots:
edit: function(e){ if(e.event.start.getTime()== Date.parse('Thu Jun 06 2013 13:45:00') && e.event.end.getTime() == Date.parse('Thu Jun 06 2013 14:00:00')){ e.preventDefault() alert('Lounch time!') } },
Dojo demo: https://dojo.telerik.com/eHOFoPEc
Regards,
Nikolay
Hi Nikolay,
Thanks you for your response. I can't put date here for caparison because i want it for every day not for single day.
and this is not working when MajorTick is set to 60 for particular day and time slot 1 to 2 PM (PFA the same)
majorTick: 60, edit: function(e){ if(e.event.start.getTime()== Date.parse('Thu Jun 06 2013 13:00:00') && e.event.end.getTime() == Date.parse('Thu Jun 06 2013 14:00:00')){ e.preventDefault() alert('Lounch time!') }
Regards
Pankaj
Hi Nikolay,
Request you to please provide me solution for this.
Regards
Pankaj
Hi Pankaj,
Could you please try to extend the if conditions and check not only the hour but also the minutes of the event in the edit event handler? Below is an example:
edit: function(e){ if( (e.event.start.getHours() >= 13 && e.event.end.getHours() <= 14 && e.event.start.getMinutes() > 30 && e.event.end.getMinutes() < 45) || (e.event.start.getHours() >= 13 && e.event.end.getHours() <= 14 && e.event.start.getMinutes() == 30 && e.event.end.getMinutes() == 0) ){ e.preventDefault() alert('Lounch time!') } },
Here is the modified Dojo example.
Regards,
Neli