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

Cell from 00:00:00 to 23:59:59 and not 12:00:00 to 12:00:00

Asked by Anonymous
8 years ago.

Hi! I would like to change cell position under days in my scheduler. Currently it is half cell in one day and other half in another. I woould like to have cell under day.
Thank you
Martin

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

You are probably using the sample project from the Hotel tutorial:

https://code.daypilot.org/27453/html5-hotel-room-booking-javascript-php

That project uses a manually generated time scale to adjust the cell start and end to match the check-in and check-out time.

Just use dp.scale = "Day" instead of dp.scale = "Manual" if you want to disable it.

Comment posted by Anonymous
8 years ago.

It's set to Day, put it to Manual and back to Day and no change.

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

If it's set to "Day" then it will generate day cells from 00:00 to 24:00, take a look at this demo:
http://javascript.daypilot.org/demo/scheduler/scaledays.html

If you still have the problem, can you post a sample config that reproduces the issue?

Comment posted by Anonymous
8 years ago.

I just download demo from the hotel room booking again. Didn't change anything, but cells are still from 12 to 12, even when they are set to "Day".

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

The hotel room booking project overrides the .scale value in loadTimeline() method:

function loadTimeline(date) {
  dp.scale = "Manual";
  dp.timeline = [];
  var start = date.getDatePart().addHours(12);

  for (var i = 0; i < dp.days; i++) {
      dp.timeline.push({start: start.addDays(i), end: start.addDays(i+1)});
  }
  dp.update();
}

You need to change it there like this:

function loadTimeline(date) {
  dp.scale = "Day";
  dp.startDate = date;
  dp.update();
}

Comment posted by Anonymous
8 years ago.

Thank you! Its working

Comment posted by Anonymous
8 years ago.

And ..is there anything like copy and paste cell on right click, button, etc? Or drag and copy without option?

Comment posted by Anonymous
8 years ago.

No worries, I already figured it out. Made Copy button on edit page.

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

You can also implement copy & paste using context menu. It's described here:
https://doc.daypilot.org/scheduler/event-copying/

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