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

Can cell widths be set differently for business/non-business times?

Asked by David Liquori
4 years ago.

I'm using a JavaScript scheduler to schedule a busy machine-shop and most of our work is scheduled on a M-F basis. I don't want to hide Saturday and Sunday, because we occasionally schedule work on those days. However, I would like to devote fewer pixels to Saturdays and Sundays. I can't seem to address widths using CSS classes. I already have a fixed cell width and a slider as per your tutorial and it updates the cellwidth using the following code:

$(document).ready(function() {
$("#cellwidth")[0].oninput = function(ev) {
var cellwidth = parseInt(this.value);
$("#label").html(cellwidth);
var date = dp.getViewPort().start.addTime((dp.getViewPort().end.getTime() - dp.getViewPort().start.getTime())/2);
dp.cellWidth = cellwidth;
dp.update();
dp.scrollTo(date, null, "middle");
};

Is there any way to set cell widths differently for business vs non-business cells?

Any info is appreciated. Much thanks in advance!

Comment posted by Alex
4 years ago.

Hi,

you could use a custom timeline to specify a different width for business cells: https://doc.daypilot.org/scheduler/timeline/

Comment posted by David Liquori
4 years ago.

Alex,

Thanks for the reply. Is it safe to assume I would no longer be able to use infinite scrolling when specifying a manual timeline? Are there any events that would force a reload of the timeline array? For instance, if I call dp.update, do I need to redefine the timeline array?

Thanks!

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

Hi David,

That's correct - the manual timeline can't be use in combination with the infinite scrolling.

Since version 2019.3.3947, you can use onIncludeTimeCell to modify the cell width during automatic timeline generation. This example will set the width of weekend cells to 5 pixels:

dp.onIncludeTimeCell = function(args) {
  var dow = args.cell.start.getDayOfWeek();
  if (dow === 6 || dow === 0) {
    args.cell.width = 5;
  }
};

This way you can continue using the infinite scrolling. Please let me know if it doesn't work as expected.

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