Yes, you can do this. Timeline stores the original source objects for your
events inside the event object. You can retrieve them by using
evt.getProperty(attributeName)
e.g.
evt.getProperty("customfield_1")
evt.getProperty("customfield_2")
No processing is performed on the custom properties when they are stored. For
example if you have an extra attribute called "middle_date": "06-23-2012" then
.getProperty("middle_date") returns you the string "06-23-2012" and not a js
date object.
If you are just looking to display custom attributes in the text of the bubble,
you can also override the default fillInfoBubble method or assign custom
fillInfoBubble methods to your events. This is safer and easier than trying to
customize the Timeline source code at the _showBubble level (unless you want
to change the behavior of showing the bubble itself)
--Mike
On Sep 11, 2012, at 7:37 AM, Maurizio Liberato wrote:
> Hi all, still new to timeline, so excuse any obvious mistake...
>
> What I would like to do is add couple of custom fields to the data source and
> retrieve them. For instance:
>
> Data source:
>
> {"events":
> [
> {"isDuration": "true", "description": "my description", "color":
> "#ffcc00", "image": "/images/Family-Life.jpg", "link":
> "http://www.google.co.uk", "icon": "/static/images/red-ico.png", "end": null,
> "title": "event title", "start": "2012,09,30", "textColor": "#777",
> "customfield_1": "ABC", "customfield_2": "DEF"}, ...{}
> ]
> }
>
> And to retrieve them on showBubble click:
>
>
> Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {
> var mycustomfield1 = evt.getCustom1();
> var mycustomfield1 = evt.getCustom2();
> }
>
>
> Is it possible to add (and how) these get methods?
>
> Thanks in advance
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "SIMILE Widgets" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/simile-widgets/-/j8Kk48u3R-QJ.
> 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.