Thanks Adrien! That's extremely helpful!

Adrien Di Mascio wrote:
> Hi,
>
> On Mon, Sep 8, 2008 at 10:47 PM, MPS <[EMAIL PROTECTED]> wrote:
>
> >
> > I'm overriding fillInfoBubble() to do some custom stuff with my info
> > bubbles.
> >
> > I need to access some info about the event that was clicked on inside
> > my fillInfoBubble() method.
> >
> > I came up with a solution for this, but it seems a bit kludgey and I'm
> > wondering if there's a better solution.
> >
> > Inside the "event" XML node, I am embedding the data I need encoded as
> > a JSON object, like so:
> >
> > <event .... >
> >      {'param1':'val1', 'param2', 'val2'... }
> > </event>
> >
>
> First of all, you can access to the original XML node through the "_node"
> attribute
> of the Event object. So, IMHO, it would be a better solution to use
> `this._node.description` instead of  `elmt.innerHTML`. Better yet, you could
> add a special attribute in your event XML node like :
>
> <event start="..." mydata="{param1: value1, ...}">...</event>
>
> and then, in fillInfoBubble, do something like :
>
> eval( '(' + this._node.getAttribute('mydata') + ')' );
>
> Finally, my personal choice would be, if you can, to seve a JSON file
> directly
> instead of a XML file and use loadJSON instead of loadXML. The structure is
> basically the same, but you could extend your event structure directly like
> in :
>
> {start: "...", mydata: "..."}
>
> and then, in fillInfoBubble() write the following code to access your data :
>
> this._obj.mydata
>
> Note that when using loadJSON, the original object is stored in the `_obj`
> attribute rather
> than `_node` which I personally find a bit confusing.
>
> Hope this helps,
>
> Adrien.
--~--~---------~--~----~------------~-------~--~----~
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