You might consider building the links in the grid using the A() helper -- 
if you specify the cid argument, it will trap the link and load it as a 
component:

A('Remove', _href=URL('default', 'grid.load', args=['delete', item.uuid]),cid
=request.cid)

Each link should include the uuid of the item in that row. When the link is 
clicked, it will make an Ajax request back to the grid component action, 
with the item uuid in request.args[1]. The grid component action can check 
for "delete" in request.args[0], and if present, remove the item whose uuid 
is in request.args[1]. It will then return the updated grid, and on the 
client side, the response will be inserted into the div of the grid 
component.

See http://web2py.com/books/default/chapter/29/5#Built-in-helpers and 
http://web2py.com/books/default/chapter/29/12#Trapped-Ajax-links.

You'll probably want to do some authorization, and maybe add a signature to 
the URL: http://web2py.com/books/default/chapter/29/4#Digitally-signed-urls.

Anthony

On Friday, June 1, 2012 6:43:37 AM UTC-4, Johann Spies wrote:
>
> I have a screen with a simple search form in the top halve and a grid at 
> the bottom part showing the items found in the search a session variable.  
> The grid part is a component.
>
> I want to be able to remove individual items from the grid without leaving 
> the page - just reloading the component part.
>
> The grid query uses session.skrywers (a list) to build the grid.  If I put 
> in a link with the label 'Remove' in the row that will do 
> 'session.skrywers.remove(db.table[request.args(0)].uuid) and reload the 
> grid (bottom part of the screen) it will be perfect.  
>
> How do I do it without leaving the page? 
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

Reply via email to