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

Change text content of an event client side?

Asked by LarryDavidJr
8 years ago.

Hi,

Had a good look around for this. Found one or two things that don't seem to work so I'll ask.

I've got the Notify event model working fine. However, I'd also like to update the text of an event as its displayed in the scheduler from the client side.

Currently, I have to wait until the notify call to the server which re-loads the scheduler (I have code to customize the text content of events server side).

I am using the Notify queue as a sort of 'do work before saving' mechanism, which works fine, but if users change something that should change the event text, it looks to them like it hasn't worked, because the text does not change.

i.e.:
//Update the event object that I found
e.end(endDateTime);
e.start(startDateTime);
e.resource($("#resource").val());
e.value($("#value").val());
e.text($("#employee").children('option:selected').text());
var eventData = new Object();
eventData.employee_id = $("#employee").val()
eventData.eventtypeid = $("#eventtype").val();

//Queue the changes
StoreScheduler.events.update(e, eventData).queue();

This works but the event in the scheduler on screen still has the old text. I can't find a reference to being able to change the text directly in any of the documentation.

Also, while we're on this subject, is there any way to change the background color of an event from client side? (somethign else I'm doing server side on an event by event basis, but would like to replicate client side).

I'm using 6.9.2525.1 DEMO

Answer posted by Dan Letecky [DayPilot]
8 years ago.

There is a set of methods that allow you to set the client-side properties:

e.client.innerHTML("New HTML");
e.client.cssClass("newClass");
e.client.toolTip("New ToolTip");
e.client.backColor("#dddddd");
e.client.barColor("red");
e.client.barVisible(true);
e.client.contextMenu(menu); or e.client.contextMenu("menu");
e.client.moveEnabled(true);
e.client.resizeEnabled(true);
e.client.rightClickEnabled(true);
e.client.clickEnabled(true);
e.client.doubleClickEnabled(true);

It will appear soon in the DayPilot.Event API docs:

http://api.daypilot.org/daypilot-event-class/

In the next release (7.0), using e.text() will automatically set e.client.innerHTML() too.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.