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

DayPilot.CellArray.invalidate

Asked by Leo
20 days ago.

Hi Dan,

The following command seems to have no effect (or at least does not trigger DayPilot.Scheduler.onBeforeCellRender:

DayPilot.cells.all().invalidate();

DayPilot.cells.all() does contain all cells, but the invalidation does not take effect.

DayPilot.Scheduler.update() does work however and trigger the onBeforeCellRender correctly.

Answer posted by Dan Letecky [DayPilot]
19 days ago.

Hi Leo,

The purpose of the invalidate() method is to clear the cached cell customization results (the args.cell.properties values set in onBeforeCellRender). It doesn’t force a refresh of the cells. The cells are re-rendered when necessary, e.g. during an update() call, when events are moved (cells in the source and target rows), etc.

If you want to refresh all cells, calling update() is the best way.

Comment posted by Leo
19 days ago.

Hi Dan,

Many thanks! I am fetching cell data async and then applying it, and looking to force a re-render of those cells that have new args.cell.properties. Is there a way to avoid updating all of them?

(We are fetching month by month async, meaning I usually only need to update one month albeit displaying multiple months.)

Thank you!

Comment posted by Dan Letecky [DayPilot]
19 days ago.

Do you fetch the cell data for additional months during scrolling?

Comment posted by Leo
19 days ago.

No, no scrolling is involved. We allow switching between showing a month, 3 months and 6 months, as well as navigating back and forth a month.

So I just load whatever data was not fetched yet.

Comment posted by Dan Letecky [DayPilot]
19 days ago.

1. And what is the reason for not loading all the data at once? Does it take a long time to calculate it?

2. When you show 6 months, I assume that only a part of this time range is in the viewport. By default, the cells render progressively and onBeforeCellRender is only called for cells that are actually rendered. So if you load the data in advance (not necessarily at once), onBeforeCellRender will use it when first rendering the event.

Comment posted by Leo
19 days ago.
  1. Yes - it’s database/backend heavy. We use (some of) the cells to display utilization.

  2. We enforce a minimum cell width, but adapt to screen size. Some of our customers have massive screens, so 3 to 6 months may actually fit on there (and they might want to see all the data at once…)

We can use the general update() method - I am just trying to optimise as much as possible and misunderstood the invalidate().

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