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

React schedule Pro (trial) > Best practice for creating "bucket" cells in the timeline grid

Asked by andy
1 day ago.

I'm trying to divide each timeline cell into a vertical stack of clickable "buckets."

My current approach uses onBeforeCellDomAdd to render multiple <div>s inside the cell. To get the height for each bucket, I'm calculating it based on the total row height, which I'm accessing via args.cell.row.Kr.height, considering the fact that the row height is dynamic, as it is determined by the volume of events assigned to that resource.

I suspect Kr is an internal property, and I'm concerned that relying on it will be unstable and could break with future updates.

Is there a more stable, officially supported way to get the final row height within this event? Or is there a better overall approach to achieve this kind of sub-grid layout within a cell?

Thank you.

    onBeforeCellDomAdd: (args) => {
      const totalRowHeight = args.cell.row?.Kr.height;
      const bucketCount = args.cell.row?.Kr.lines.length || 1;

     args.element = <>
      {Array.from({ length: bucketCount }).map((_, index) => (
        <StyledSquareCellBucket
          style={{ height: (totalRowHeight / bucketCount) }}
          onClick={(e) => {
            e.stopPropagation();
            e.preventDefault();

            console.info("Clicked on a cell");
          }}
        >
          +
        </StyledSquareCellBucket>
      ))}</>
    }
Answer posted by Dan Letecky [DayPilot]
1 day ago.

Yes, this is an internal property and its name will change in the future.

I would try to split the resources vertically using the split resources feature. It lets you define sub-resources for each resource. They can be represented by a special row in the row headers but you can only display the parent row in the headers if you only want to apply it to the grid.

Please let me know if this doesn’t work for you.

Comment posted by andy
1 day ago.

Hello Dan,

Thank you for the fast response.

I don’t think split resource work for our use case because we can’t accurately determine how many sub-resources to include in `split` array when building out the `resources` array, especially how many lines are used when stacking events at a given time.

In the meantime, I believe having access to a stable, unchanging equivalence of `args.cell.row?.Kr.height` and `args.cell.row?.Kr.lines` should be sufficient as a workaround.

If there are future official supports for this (without the above workaround), i would love to be notified!

Comment posted by Dan Letecky [DayPilot]
20 hours ago.

Andy,

Thanks for the update. The height (current height in pixels) and lines (number of lines) properties are now available in the DayPilot.Row object (i.e. args.cell.row) in the latest sandbox build (2025.3.6622).

Please let me know if it doesn’t work as expected.

Comment posted by andy
19 hours ago.

Hi Dan,

It is working as expected.

I appreciate you being responsive and having fast turnaround!

Comment posted by Dan Letecky [DayPilot]
18 hours ago.

Great, thanks for the update!

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