On 27-Nov-06, at 2:07 PM, Igor Foox wrote:
<snip>
> And also another related question about AjaxGrid. How do I set rows
> to be a link, or at the very least hang an 'onclick' action on
> them? There seems to be something possible with the 'actions'
> parameter to the grid, but it's not trivial to figure out from the
> code, and I'm wondering if its use is documented somewhere.
I've tried doing this by passing an 'actions' parameter to the widget
and I did a little bit farther along but I could only do this by
hacking the ajaxgrid.js file itself.
AjaxGrid.prototype.refresh does an eval() on the parameters it sends
to the server-side refresh method, however
AjaxGrid.prototype.updateGrid doesn't, and just sends the response it
gets to Widget.grid.render.
The problem with this is that Widget.grid.renderRows (called from
Widget.grid.render) does the following:
var actions = Widget.exists(content.actions)? content.actions:{};
...
var p = actions.select.params.concat(row_id);
The problem here is that actions.select.params.concat can't possibly
be a JS function because it's just the stuff returned as JSON from
the server, so this always fails. Similar stuff is done in
Widget.grid.renderRowActionsLink.
The only way I could make this work is by putting this in ajaxgrid.js:
response.actions.select.params.concat = eval
(response.actions.select.params.concat);
which turns it into a function which can then be applied to an
argument. This is obviously not a very good solution because we then
need to check and eval every possible function that we're given in
ajax grid, maybe this logic belongs in the place that calls these
functions?
Or maybe I'm just misunderstanding how I'm supposed to use these
functions, in which case please do correct me. :-)
Igor
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---