Our powerful JS Calendar component


Post by srhodes »

Hello,

I need to be able to customise the cells in month view such that events of the same kind are displayed as a group.

For instance the following events (timeline view):

Image

should be displayed like this in month view:

Image

The green buttons would ideally be clickable and draggable from one day to another.

Is this possible? If so, how should I go about achieving this? I haven't had much success with cellRenderer/dayCellRenderer/eventRenderer so far.

Thank you!


Post by Animal »

This would require a rewrite of the cellRenderer internal function which creates content for a day cell.

The section inside that which creates child elements for the actual event container element could be broken out into a function which could then be overridden by custom code.

Here is a ticket for tracking: https://github.com/bryntum/support/issues/3258


Post by Animal »

Meanwhile, if you create a subclass of MonthView, copy in the cellRenderer method from the DayCellRenderer mixin, and you can try the surgery yourself.

The loop beginning

            for (let i = 0, eventRow = 0; i < maxRow; i++, eventRow++) {
                const renderedEvent = events[i];

                // If the slot is occupied, add a child event element.
                // The event's .b-cal-event-wrap is position:absolute, so its offsetParent is the closest
                // position:relative element which is the .b-calendar-days row.
                // This is so that the events can use %age widths and need no intervention

It's the iteration of the event info blocks that intersect with the cell (intersect because events may span days)

The children array is the DomSync elements configs that will become the content of the eventBarContainer of the cell.

It's empty obviously at first, so you can place in there what you want.

As long as the actual event bars have the same internal structure and CSS classes as in the default rendering, they should still be picked up as draggable.


Post by srhodes »

Thank you! 👍


Post Reply