The distinction is between Timeline.DefaultEventSource.loadJSON and Timeline.DefaultEventSource.Event. In the loadJSON function, the code looks for a 'title' attribute in the json, but passes that value as the 'text' attribute to the new Event constructor.
In the example I gave, I'm calling the new Event constructor directly, and thus need to pass in a value for 'text' and not 'title'. --Mike Nosal On Sep 20, 2009, at 2:14 PM, mabra wrote: > > Hello ! > > Could you please me to that source, which indicates, that "title" was > removed??? "title" works fine for me, using TL 2.3 !! > > br--mabra > > > matthew wrote: >> Awesome, that works! >> >> I was looking at some source and saw that durationEvent had changed >> but >> didn't see that title was gone. >> >> Thanks a lot for you help! >> >> -matthew >> >> On Thu, Sep 17, 2009 at 2: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 -~----------~----~----~----~------~----~------~--~---
