Suggest. Add parameters to scheduler.renderEvent()


There is a way to implement custom Event’s box, by overriding the scheduler.renderEvent() method.

The call to this method is done in scheduler._render_v_bar() method in this way :

scheduler.renderEvent(container, ev)

With container… containing native event’s box wrapper and event… containing the event.

That’s great to build the box from scratch.
But for soft customization this method does not look totally optimized.

I explain the situation (taking into account the custom renderEvent() method has to goal to build the same box as the native one) :

scheduler._render_v_bar() does two useful things both before calling the custom renderEvent() or building the native event’s box :

  • The method knows some incoming params which it uses when building the native event’s box like : dimensions and generated contents (precisely w, h, contentA, contentB abnd bottom too know if it’s an event or a menu).
  • The method computes some data, like color and bg_color.

So, scheduler._render_v_bar() has got all data needed to build a native event’s box.

But in the custom renderEvent() method only the container and event are given, so it is not possible to take benefits from the pre-calculated data.

It’s not rconvenient for two reasons :

  • The custom renderEvent() has to generate itself the contents (by calling the scheduler.templates.event_* methods and calculate color/bg_color again) although theses contents have already been generated before but are just not accessible in the custom renderEvent() : contentA, contentB, color, bg_color.
  • The custom renderEvent() does not know native dimensions (width / height / bottom). The only way is to get style properties of the container element and reverse previous calculation (eg. to get the same “width” of native event’s box footer it need to get the container width + 4 - 8, which seems too dependent on the calculation rules of the container, which is already build when given in the custom renderEvent()).

All that to say it would be great that the call of custom renderEvent() could bring all “known or already-calculated” parameters. Like :

if (!bottom && scheduler.renderEvent(container, ev, w, h, contentA, contentB, bottom))

And even :

if (!bottom && scheduler.renderEvent(container, ev, w, h, contentA, contentB, bottom, bg_color, color))

With this last condition, it is possible to just copy/paste the “native” event’s box building (from “var inner_html =” to " […]= inner_html;" to get the same event box and be able to just do some soft customizations.

What do you think about ?

NB : I feel that one new release will come soon… I try to profit :slight_smile:

NB2 : I do not know if it would be useful to pass additional parameters like ‘x’, ‘y’, ‘style’ por if bottom is really needed as parameter because alwasy undefined in the custom call (but that permitted the copy/paste !)

thank you for the feedback!
We’ve added additional parameters to the renderEvent function. So starting from the next version the method declaration would look like following:scheduler.renderEvent = function(container, ev, width, height, head_content, body_content) { ... };

Perfect, thanks to have taken this suggestion into account !