serializing as json is like writing in JS...
just serialize your values like this :
newoptions = ${simplejson.dumps(widget_options)}
=> where widget_options is a python dict
and then in js, merge newoptions to options (depends on your js
framework :) any superior one would have a simple function to do that)
Jon
On 15 jan, 06:48, Shane <[email protected]> wrote:
> Hi,
>
> I'm writing some custom code that wraps some JQuery javascript UI
> components. Not writing widgets yet, just simple wrappers. Is there
> a simple/clever way I can pass a boolean true from the TG side to the
> JS in a template? I basically need an:
>
> options.border=true
>
> to appear in the template JS when all I can do is pass a string. The
> only thing I can think of is to write a JS function to loop through
> entire objects looking for values passed from TG (say a "TG_TRUE"
> value) and when if finds one set this value to JS Boolean true. Is
> there anything more clever than this? If no, is there a JS library/
> function which does this that supports traversing through nested
> objects?
>
> Thanks,
> Shane
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.