Hi All !
In my case - I use additional "custom properties" per event - the
shown methods did'nt work [may be my fault], but declaring the event
like this:
var json = {
'dateTimeFormat': 'iso8601',
'events':
[
{ 'id': '17', 'start': ......,
'myCustomClass': '1' }
]
};
and then:
tlEventSource.loadJSON(json, document.location.href);
This works even for my custom properties - don't know, why the other
methods didnt for;May be my fault. But anyway, I pull them via ajax
from the server and use always the same structure. No layout/paint is
necessary this way.
Michael wrote:
"Same thing for removing events
from the timeline. Just find the event you want in the EventSource's
array of events and remove it from the array. "
But for removing events:I found not one sample. If I look with firebug
to the objects, I am finding:
_events._events._.a
but if I use ".shift()" to remove the first event, nothing happens,
using paint/layout or not.
There is a call for changes open to add a remove/delete method to the
eventsource and I'll go and vote for it.
I have a long running application - showing IT environment events and
relationships - which starts with about ~500 events and it get's
updates up to 50 per hour. So I am ending up with too many events and
each insert needs a long time :-(
If I have > 1000, I clear the eventsource and relod the half of them,
like in a batch;Sad, cost really much time. Just my notes. Timeline is
a great work, but it needs some extensions, like finding/getting
events without enum them all [like get first, get oldest, get last,
get newest, getbyId {note that you can currently get the latest/newest
time, not the event}].
br--mabra
On Sep 17, 8:21 pm, Michael Nosal <[email protected]> wrote:
> Simplify your date handling, and check the values used by
> Timeline.DefaultEventSource.Event.
> The attribute names and arguments have changed as Timeline gets
> updated. This is for the code on the trunk at
> simile-widgets.googlecode.com/svn
> .
>
> Try this:
> var time = "04-17-2009 12:00";
> var d = new Date(time.replace(/-/g,"/")); // new Date can handle
> 04/17/2009
> var evt = new Timeline.DefaultEventSource.Event ({
> id: 'F',
> start: d,
> end: d,
> instant : true,
> text : "An event",
> description : "A description",
> });
> tl.getBand(0).getEventSource().add(evt);
>
> tl.paint();
>
> /* or you can create a listener for 'onAddOne'
> * that does this automatically for you
> */
>
> You should see the instant event appear on your timeline.
>
> --Mike
>
> On Sep 17, 2009, at 12:29 PM, matthew wrote:
>
> > var dateString = time.substring(0, idx);
> > var timeString = time.substring(idx+1, time.length);
> > var tmp = dateString.split('-');
> > var arr = timeString.split(':');
>
> > debug_out("tmp[2] = "+tmp[2]+" tmp[1] = "+tmp[1]+" tmp[0] =
> > "+tmp[0]);
>
> > var d = new Date(Number(tmp[2]), Number(tmp[0])-1, Number(tmp
> > [1]), Number(arr[0]), Number(arr[1]));
> > debug_out(d);
> > var evt = new Timeline.DefaultEventSource.Event ({
> > 'id': 'F',
> > 'start': new Date(Number(tmp[2]), Number(tmp[0])-1,
> > Number(tmp[1]), Number(arr[0]), Number(arr[1])),
> > 'end': new Date(Number(tmp[2]), Number(tmp[0])-1,
> > Number(tmp[1]), Number(arr[0]), Number(arr[1])),
> > 'title': 'TEST EVENT ',
> > 'dateTimeFormat': 'iso8601',
> > 'durationEvent': false
> > });
> > tl.getBand(0).getEventSource().add(evt);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---