You can change events at any time after they have been loaded.
The events are accessible through the EventSource object.

Timeline doesn't have event setters, but they are easy enough to add:
jQuery.extend(Timeline.DefaultEventSource.Event.prototype,{
        setStart:       function(start) {if (start != null) this._start = 
start;},
        setEnd: function(end) { if (end != null) this._end = end;}
});

Once you have access to the individual event, you can change any of the 
properties of the object and then have the timeline repaint.

For example, given:
var eventSource = new Timeline.DefaultEventSource();
...
tl.loadXML("events.xml",function(xml,url) {
        eventSource.loadXML(xml,url);
}
Your events are now painted on your timeline.

Then to update an event, first get the EventSource object where it lives:
var  es = tl.getBand(1).getEventSource();

You can access specific events by id:
es.getEvent("e1")

or use an event iterator to iterate over all the events:
es.getAllEventIterator()

You can also get an iterator to return events between a pair of dates.

Now you can call:
var e = es.getEvent("e1"); // get a specific event by its id
e.setStart(new Date("02/14/2011 12:45"));
e.setEnd(new Date("02/14/2011 17:30")

When you have finished changing your events, just call paint() on your timeline:
tl.paint();

You can easily add additional event setters, for event text, description, etc. 
if you need to update more properties than just start/end.

--Mike


On May 19, 2011, at 12:01 PM, Udo Loeb wrote:

> Hi!
> 
> I guess this is something that I also tried to figure out recently, so 
> I'd like to clear this, hopefully its useful for others, too:
> 
> What I (and maybe espressoguy) try to do is, change an event, that is 
> already loaded / painted, in other words:
> 1. You load events with certain specs with loadXML.
> -> They will be "painted" onto the timeline.
> 2. Then you want to change an event, that is already painted.
> 
> Is this possible?
> 
> I tried to add a condition / check to the event loading, that simply 
> clears / deletes events that are already painted, but I ran into 
> problems, as events are painted again and again, depending on user 
> interactions like scrolling.
> 
> As far as I see there is no feature like "updateEvent" or 
> "changeEventProperties" provided, or am I wrong?
> 
> Thanx for any feedback,
> 
> kind regards,
> 
> Udo

-- 
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en.

Reply via email to