Thanks for the help, but I am still a little confused. As some
background, I am wrapping the jqGrid library. I know there is a
widget for it, but the functionality I need (copy between tables,
subgrids) I think is too deep to use the canned widget. I though it
simpler to just wrap the jqGrid in some Python that essentially builds
the options dict to be passed from the TG controller to the template.
Urls, values, etc all work fine (just passing JSON data as is normally
done from controller->template (just the canned version of what
Jonathan is suggesting, I think). My problem is the Booleans. When I
try to set a jqGrid row to editable. I need:
options.colModel[0].editable = true (or false)
to somehow appear in the template. I had been setting it to 'true',
'1', '', etc to try and make the JS cast it correctly, but no joy.
@Jonathan - Does what you suggest work for JS booleans? I can pass
'1' or 'True' or 'true', but I can't figure our how to pass a JS
boolean true using JSON w/o some sort of value conversion on the JS
side. I have also tried passing a Null string ('') and while this
casts to false in a JS conditional, it doesn't work for setting this
options flag. Not sure why, I would have thought that somewhere a ''
or 'whatever' would get evaluated to a boolean false/true but it
doesn't seem to work.
@Diez - I had been using a wrapper class that just build dicts to pass
to templates w/o subclassing Widget. I suppose I should start
learning how to code Widgets anyway. Still, just for future
reference, lets say you just wanted to pass a boolean to JS using JSON
w/o using the Widget class. It seems to me that since JSON is
basically just a collection of strings, you have to have something on
the JS side that would be dedicated to looping through all passed JSON
values and looking for some true/false string_flag. Otherwise, no
matter what you do, JS can never tell a Boolean from a String just by
looking at the JSON. Your example just ignores the JSON entirely and
manipulates the template directly. Just wondering if there was
another way...
- Shane
On Jan 15, 8:09 am, "Diez B. Roggisch" <[email protected]> wrote:
> Sorry, forgot this link:
>
> http://toscawidgets.org/documentation/ToscaWidgets/usage.html#resources
>
> Diez
--
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.