Hi, I'd like to show the date heading in a different style for today's date in week view.
Is it possible? I've updated the CSS on the time slot and that only changes the actual timeslots, not the corresponding heading for that day.
Thanks!
Is it possible? I've updated the CSS on the time slot and that only changes the actual timeslots, not the corresponding heading for that day.
Thanks!
7 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 13 Feb 2013, 09:11 AM
Hi Rimma,
Try the following Javascript to style the today's date in week view.
Javascript:
Thanks,
Princy.
Try the following Javascript to style the today's date in week view.
Javascript:
<script type="text/javascript">function pageLoad() { $telerik.$(".rsHorizontalHeaderTable th").each(function (index, item) { var childNode = item.childNodes[0]; if (childNode != null) { var today = new Date(); today.setHours(0); today.setMinutes(0); today.setSeconds(0); if (childNode.href != null) { var hrefDate = childNode.href.split('#')[1]; var date = new Date(hrefDate); date.setHours(0); date.setMinutes(0); date.setSeconds(0); if (date.toDateString() == today.toDateString()) { item.style.backgroundImage = "none"; item.style.backgroundColor = "yellow"; } } else { var innerText = childNode.innerHTML.trim(); var date = new Date(innerText); date.setHours(0); date.setMinutes(0); date.setSeconds(0); if (date.toDateString() == today.toDateString()) { item.style.backgroundImage = "none"; item.style.backgroundColor = "yellow"; } } } });}</script>Thanks,
Princy.
0
Mehmet
Top achievements
Rank 1
answered on 17 Nov 2014, 03:01 AM
Hi,
It does highlight the same day's name for all weeks-months.
So why does it happen?
It does highlight the same day's name for all weeks-months.
So why does it happen?
0
Hello,
I would like to clarify that solution provided by Princy highlights the today's date in week view's heading section. It does not highlight the date only in week view and does not highlight in same day for each month. It only colors the today's date this year.
Regards,
Boyan Dimitrov
Telerik
I would like to clarify that solution provided by Princy highlights the today's date in week view's heading section. It does not highlight the date only in week view and does not highlight in same day for each month. It only colors the today's date this year.
Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Mehmet
Top achievements
Rank 1
answered on 20 Nov 2014, 11:10 PM
What is the solution to just highlight today's date on the current week rather than the all year's today date's name ?
Thank you
Thank you
0
Hello,
I guess that you want to color all time slots for today's date in the week view. You can achieve this by using the RadScheduler OnTimeSlotCreated event and sets custom class for all today's date time slots:
//code behind
Using css you can set the time slot element background color.
Regards,
Boyan Dimitrov
Telerik
I guess that you want to color all time slots for today's date in the week view. You can achieve this by using the RadScheduler OnTimeSlotCreated event and sets custom class for all today's date time slots:
//code behind
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e) { if (RadScheduler1.SelectedView == SchedulerViewType.WeekView && e.TimeSlot.Start.Date == DateTime.Now.Date) { e.TimeSlot.CssClass = "todaysDate"; } }Using css you can set the time slot element background color.
Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Mehmet
Top achievements
Rank 1
answered on 24 Nov 2014, 10:03 PM
Can you provide me a JS code of it?
Thank you
Thank you
0
Hello,
Please find the client-side solution below:
//JavaScript
//css
Regards,
Boyan Dimitrov
Telerik
Please find the client-side solution below:
//JavaScript
function pageLoad() { var scheduler = $find("<%= RadScheduler1.ClientID %>"); if (scheduler.get_selectedView() == 1) { var timeSlotsDOM = $telerik.$($telerik.$(".rsContentTable tr td")); for (var i = 0; i < timeSlotsDOM.length; i++) { var DOMElement = timeSlotsDOM[i]; var date = $find("RadScheduler1").get_activeModel().getTimeSlotFromDomElement(DOMElement).get_startTime().toDateString(); var todayDate = new Date().toDateString(); if (date == todayDate) { $telerik.$(DOMElement).addClass("todaysClass"); } } } }.todaysClass { background-color:red; }Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.