Setting the event colour on the scheduler

Hi,

I am trying to set event colour and refresh the page when a user saves an event.

A previous example i had used

    string color = <define color from category id somehow>;
    var result = new AjaxSaveResponse(action);
    result.UpdateField("textColor", color);
    return result;

However, I am now using

var result = new SchedulerFormResponseScript(action, changedEvent);
                return result;

How do i set the colour and tell it to redraw in this instance?

hi
you may just assing value to the property, and it will be updated on the client

string color = <define color from category id somehow>; changedEvent.textColor = color; return (new SchedulerFormResponseScript(action, changedEvent));

This is still not working, the result is ignored sand the scheduler is not reloaded. Is there something that needs entyering into the scheduler.js?

no additional changes required, all you need to do is to set values before you pass event to SchedulerFormResponseScript. values should be updated on the client

do you get any script errors?

No, there are no script errors.

The problem appears to be that the page is not refreshed, so even if i manually pass a colour back, then the event colour created is changed. The event is not repeated through the scheduler, untill ii manually refresh the page.

Hi,
I’m not sure why do you need to refresh the page, normally server-side updates does not require it.
But anyway, you may attach “afterchange” event and refresh scheduler from there

<script> scheduler.attachEvent("onEventChanged", function (id, event_obj) { .... }); </script>there you may call

scheduler.setCurrentView() - it will redraw scheduler’s view entirely,
or

scheduler.render_view_data() - to redraw only events