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

Scheduler: issue with resources spanning multiple rows

Asked by Julien
18 hours ago.

I'm starting to use the Scheduler to display Events from multiple sources but the Events should not be displayed on a row depending on their source (resource). In other words, the minimum number of rows must be used in order to display the Events, whatever their source is.

For example, if I have EventA that is 9:00-10:00 and EventB that is 10:00-11:00, they would appear on the same row, one after the other (there would be only one row only in the Scheduler). But if both events are 9:00-10:00, then they would be one on top of the other and there would be two rows visible in the Scheduler.

To achieve that, it seems that using a single "resource" works well... I first hide the left bar:

rowHeaderWidth: 0
rowHeaderColumns: []
treeEnabled: false

and then I add all the Events to the same resource.

My issue is that it seems that when there are multiple rows required for that a single resource (both Events are 9:00-10:00 for example), that doesn't create cells everywhere on the second row!

So when I try to highlight "today" as such:

onBeforeCellRender: (args) => {
  if (args.cell.start.getDay() === DayPilot.Date.now().getDay()) {
    (args.cell as any).backColor = Colors.yellowVeryLight;
  }
}

there are parts of the second row that are not colored! (By the way, the backColor type is missing in Typescript on args.cell).

Any tips about this? Am I using the proper pattern to achieve what I need? If so, is there a way to properly color all rows for "today"?

Comment posted by Julien
14 hours ago.

I have a workaround but I think it’s very ugly and may break with a future update:

.scheduler_default_matrix > div {
  height: 100%;
}

.scheduler_default_cell {
  height: 100% !important;
}

Then all the cells of my single resource’s row take 100% and the “today” color seems to work correctly.

On a side note, I have to admit I would also like to have horizontal lines for the grid (under each stacked Events), but that seems impossible since there is only one row in my current solution…

Comment posted by Julien
13 hours ago.

Another kind of pseudo-solution I found to have working horizontal lines is to create multiple unused resources in the Scheduler, event if all Events are added to the firs one:

resources: [
  { name: '', id: 'singleResource' },
  { name: '', id: 'dummy2' },
  { name: '', id: 'dummy3' },
  { name: '', id: 'dummy4' },
],

(and all events use the “singleResource” resource.)

It seems that even when multiple events are stacked, their row height stays the same? It is surprising to me, but that actually helps my case since then horizontal lines are correct (here all Events are in the same “singleResource” resource):

Obviously, the issue with this workaround is that I have to compute how many “dummy” resources I need to add and this depends on if some Events are stacked and how deep. I' guess it’s possible to compute but doesn’t look fun!

Anyway, I’ll wait for your reply! Maybe I’m missing something obvious to achieve what I want. Thanks in advance!

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):