The JSON loader already gives you access to your original JSON event  
object. For example, in  
Timeline.DefaultEventSource.prototype.loadJSON, look at:

var evt = new Timeline.DefaultEventSource.Event(
...
);
evt._obj = evnt;
evt.getProperty = function(name) {
        return this._obj[name];
}

Now you've got a copy of all your original JSON data tacked onto the  
Event object. This is much easier than adding additional arguments to  
the Event constructor.

Then in your painter code, you can just access whatever attributes  
were on your original JSON object:

{"events" : [
        {"start" : "2001", "end" : "2003", "title" : "Blah blah",
        "flavor" : "Cherry"},
        ....
]}

You can access the "flavor" attribute in your painter code:
labelDiv.innerHTML = text;
labelDiv.title = evt.getProperty("flavor");

Or in the fillInfoBubble code:
e.g. var title = this.getProperty("myCustomTitleField");

This makes it possible to (with customizations) do just about  
anything, displaying all kinds of custom data, creative new painters,  
advanced layouts, etc.

--Mike Nosal


On Aug 5, 2009, at 4:22 PM, mabra wrote:

>
> Hi !
>
> Dependent on the type of an event, I wish to provide additional
> values, which I would see as "custom attributes". From my tests based
> on json data, these values do not cause any error. But I do not know,
> how to access them, especially in the event painter.
>
> Thanks so far!
>
> br--mabra
>
> >


--~--~---------~--~----~------------~-------~--~----~
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