search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to Override partial event with non business hours?

Asked by Bhavesh Patel
12 years ago.

Hi, This is my very first post to DayPilot Forum. Whoever created it, I guess Dan, it is brilliant job.

Let's start with my question, I am using DayPilot 5.6.1820.0 Pro version. I have DayPilotCalender set for a week(7 Days). There are already events each of 45 minsbetween 8:00 AM to 5:00 PM. Now my problem is I have to block (or Disable) lunch hour time( 1:00PM to 2:00PM). so basically I will have to make it non clickable those part. the problem is last event before lunch hour which is 12:30 to 1:15. So even if the event is 12:30 to 1:15 it should shorten the event or atleast make 1:00 PM to 2:00 PM totally non - clickable no matter what events comes inside?

so basically anything(full event or partial event)between 1:00PM to 2:00PM should be disabled?

any suggesions or any helping links would be helpful.

Thanks in advance.

Comment posted by Bhavesh Patel
12 years ago.

No reply yet?? at least let me know if it is possible or not?

Comment posted by Dan Letecky
12 years ago.

Hi, and apologies for the delay.

There are several tools you could combine to create the desired result:

1. You can define your own color of a background time cell using BeforeCellRender event handler (just change e.BackColor)

2. You can hide lunch time using BeforeTimeHeaderRender (set e.Visible = false for the second header row - i.e. when e.IsColGroup == false). Hiding the non business hours must be enabled by setting ShowNonBusiness=false.

3. You can apply your own server-side rules in the methods that handle EventMove, EventResize, etc. and deny operations that don't meet the rules. An additional message explaining the result can be displayed on the client using Update(msg) call.

4. You can hook the events on the client side using JavaScript. Set the *Handling property (e.g. TimeRangeSelectedHandling) to "JavaScript" and define *JavaScript handler (e.g. TimeRangeSelectedJavaScript). You could apply some rules here and call the server side event handler using *CallBack() method (e.g. timeRangeSelectedCallBack()).

It is not possible to make the lunch time visible but non-clickable. However, you can provide a visual hint and an immediate feedback once the action is performed. You can also automatically shorten/divide the event in the server-side event handler before changing to the database.

Please let me know if you need more details...

Comment posted by Bhavesh Patel
12 years ago.

Thanks Dan. It helps.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.