The :eval method of the ajax() function requires that there is a form field 
holding the value to be sent by ajax. So in your view you could just 
include in INPUT() helper somewhere on the page and hide it via css. Then 
when the "remove row" link is clicked, your could use js to:

- set the input value to the id of the clicked row;
- submit the input value using the :eval method;

Like this:

$('.remove_row').live('click', function(){
  var rowid = $(this).attr('id');
  $('#helper_input').val(rowid);
  ajax('path/to/controller/function'), ['helper_input'], ':eval');
}

In the controller you can remove the item from your list and then do

response.js = 
"web2py_component('path/to/view.load','id_of_component_container');"

That will mean that once your controller has run (processed the input you 
sent via ajax) the page element you specify will be re-loaded with your 
component view.

Hope this helps.

Ian


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