Hmmm, I just tried it against Timeline 2.3.0, and it works as advertised.
What version of Timeline are you using? Are you hosting it locally or off
simile-widgets.org?
In the JS console in your browser, try creating an event and see what it says.
That's all that the Event constructor really needs for an instant event.
You can see for yourself if you visit simile-widgets.org and go to one of the
example timelines.
Paste this code into the console and hit enter and you should see the new event
appear on the timeline.
function addBreakpoint()
{
var evt = new Timeline.DefaultEventSource.Event ({
start: new Date("May 03 2003 00:00:00 GMT-0600"),
instant : true,
text : "An event",
description : "A description",
});
tl.getBand(0).getEventSource().add(evt);
tl.paint();
}
addBreakpoint();
--Mike
On Aug 4, 2011, at 4:54 AM, Froggy wrote:
> Thanks for pointing that out.
> I applied your exact recommendation but I still get the same error
> message.
>
> On Aug 3, 10:50 pm, Michael Nosal <[email protected]> wrote:
>> The error message suggests that something that should be a Date object,
>> actually isn't (there is no method 'getTime')
>>
>> In your addBreakpoint function, you pass an object to the
>> Timeline.DefaultEventSource.Event constructor. In this object, the value you
>> have for start is a String, when it should be a Date. Normally, calling
>> eventSource.loadJSON() would convert the start/end strings in your JSON to
>> date objects for you before constructing a new
>> Timeline.DefaultEventSource.Event. So you just need to convert start to a
>> Date:
>>
>> function addBreakpoint()
>> {
>> var evt = new Timeline.DefaultEventSource.Event ({
>> start: new Date("Aug 03 2011 00:00:00 GMT-0600"),
>> instant : true,
>> text : "An event",
>> description : "A description"});
>>
>> This should work fine.
>> --Mike
>>
>> On Aug 3, 2011, at 12:06 PM, Froggy wrote:> Hi Everyone,
>>
>>> Just started using Timeline and having a problem I just can't find
>>> information about.
>>> I am trying to add events manually that the user selects and display
>>> them dynamically, not sure I got the grasp of everything.
>>
>>> I get the following error in Chrome's Developer Tools:
>>> Uncaught TypeError: Object #<Object> has no method 'getTime'
>>> bundle.js:4492
>>
>>> Here is the code I have:
>>> ...
>>> //Add Event
>>> function addBreakpoint()
>>> {
>>> var date = document.getElementById("eventDatepicker").value;
>>> var evt = new Timeline.DefaultEventSource.Event ({
>>> start: "Aug 03 2011 00:00:00 GMT-0600", //Hardcoded for the time
>>> being using Timeline default date
>>> instant : true,
>>> text : "An event",
>>> description : "A description",
>>> });
>>> eventSource.add(evt);
>>> tl.paint();
>>> }
>>
>>> Thanks in advance for any help you can provide!
>
> --
> 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.
>
--
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.