Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Parametrizing AjaxGrid
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Igor Foox  
View profile  
 More options Nov 20 2006, 11:31 am
From: Igor Foox <igorf...@gmail.com>
Date: Mon, 20 Nov 2006 11:31:10 -0500
Local: Mon, Nov 20 2006 11:31 am
Subject: Parametrizing AjaxGrid
Hi,

I'd like to use an AjaxGrid to display some tabular information  
instead of brewing my own widget, but I'm having trouble figuring out  
whether it can do what I want, and how.

What I'd like to do is have a page with a selection box and an  
AjaxGrid. The selection box gets populated dynamically through AJAX,  
and I'd like the AjaxGrid to be redisplayed whenever
a user selects an option from the selection box. For this I need to  
somehow pass a parameter to my json refresh method that supplies the  
data to the AjaxGrid.

Is it possible to somehow pass a parameter like this? I've seen how  
you can set a parameter in the refresh url in the constructor for the  
AjaxGrid, but that's not really useful for me here, since I don't  
know the parameter value until the user selects an option.

Any help appreciated! :-)
Igor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Foox  
View profile  
 More options Nov 27 2006, 2:07 pm
From: Igor Foox <igorf...@gmail.com>
Date: Mon, 27 Nov 2006 14:07:43 -0500
Local: Mon, Nov 27 2006 2:07 pm
Subject: Re: Parametrizing AjaxGrid

On 20-Nov-06, at 11:31 AM, Igor Foox wrote:

So after a whole bunch of poking around I figured it out, and I'll  
probably be writing it up. Is there any particular place that I can  
submit a tutorial on how to use AjaxGrid to the docs?

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.

Thanks,
Igor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile  
 More options Nov 27 2006, 2:50 pm
From: "Diez B. Roggisch" <diez.roggi...@artnology.com>
Date: Mon, 27 Nov 2006 20:50:59 +0100
Local: Mon, Nov 27 2006 2:50 pm
Subject: Re: [TurboGears] Re: Parametrizing AjaxGrid

> So after a whole bunch of poking around I figured it out, and I'll  
> probably be writing it up. Is there any particular place that I can  
> submit a tutorial on how to use AjaxGrid to the docs?

I guess the Wiki is the appropriate place.

> 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 do it like this:

import kid

def get_action(rowobject):
     return kid.XML("<a href="/whatever?id=%i">edit</a>" % rowobject.id)

You pass that to the columnobject as getter.

Diez


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Foox  
View profile  
 More options Nov 27 2006, 3:00 pm
From: Igor Foox <igorf...@gmail.com>
Date: Mon, 27 Nov 2006 15:00:47 -0500
Local: Mon, Nov 27 2006 3:00 pm
Subject: Re: [TurboGears] Re: Parametrizing AjaxGrid

On 27-Nov-06, at 2:50 PM, Diez B. Roggisch wrote:

I'm a bit confused here, what is columnobject in this instance?

Thanks,
Igor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile  
 More options Nov 27 2006, 3:29 pm
From: "Diez B. Roggisch" <diez.roggi...@artnology.com>
Date: Mon, 27 Nov 2006 21:29:49 +0100
Local: Mon, Nov 27 2006 3:29 pm
Subject: Re: [TurboGears] Re: Parametrizing AjaxGrid
Igor Foox schrieb:

Argl. I'm sorry, that was targeted towards the DataGrid widget. Sorry
for causing confusion.

But I had a look into the sourcecode - so it appears that one can return
actions to call in the json data. See widget.js - it looks somewhat more
complicated than I can now parse without having a use case on my own.

Diez


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Igor Foox  
View profile  
 More options Nov 27 2006, 3:37 pm
From: Igor Foox <igorf...@gmail.com>
Date: Mon, 27 Nov 2006 15:37:09 -0500
Local: Mon, Nov 27 2006 3:37 pm
Subject: Re: Parametrizing AjaxGrid

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »