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

Show Business Hours on Saturday using Javascript

Asked by Patrick Burrows
10 years ago.

Using the JavaScript version of Scheduler, how can I display only business hours on a Saturday? The previously supplied answers (such as: http://kb.daypilot.org/79065/how-to-show-business-hours-on-weekends-in-scheduler/) are written using ASP.Net or MVC where there is an event argument (e) that has a property called IsVisible.

However, in Javascript, the onBeforeTimeHeaderRender event only receives an "args" argument and there is no property called Visible in that data. In fact, that event is not even fired if showNonBusiness = false is set.

I've attached an Html file which reproduces this issue.

Is there a different event to use, perhaps?

Answer posted by Dan Letecky [DayPilot]
10 years ago.

Hi Patrick,

In JavaScript you should use onIncludeCell event instead:

http://doc.daypilot.org/scheduler/hiding-time-columns/

Example:

<div id="dp"></div>
<script type="text/javascript">
  var dp = new DayPilot.Scheduler("dp");
  dp.onIncludeTimeCell = function(args) {
    if (args.cell.start.getDayOfWeek() === 0) { // hide Sundays
      args.cell.visible = false;
    }
  };
  // ...
  dp.init();
</script>
Comment posted by Patrick Burrows
10 years ago.

Awesome. That worked great. (maybe add that to the KB article linked above?)

Thanks so much.

Comment posted by Dan Letecky [DayPilot]
10 years ago.

Updated, thanks!

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