Thanks, Anthony, and sorry for spreading misinformation. I just re-read the
book section and found where I'd been confused. So it looks like Johann
simply needs something like this for each row in his view:
<a href='ajax('controller_function/{{=row.id}}', [], ':eval')>X</a>
Then to refresh the component after the controller runs, he would just
return "web2py_component('path/to/view.load','id_of_component_container');"
I'm just not quite sure what you mean that "response.js is only used when a
component is called via web2py_component()." I've been using that as a
standard way of refreshing components after form submission. If I can just
"return" the javascript as a string (as the component function's return
val) then when exactly would I use response.js? I'm just not sure what you
mean by "when a component is called via web2py_component()."
I stepped in to offer help and now I'm learning myself :)
On Friday, June 1, 2012 12:47:33 PM UTC-4, Anthony wrote:
>
> The :eval method of the ajax() function requires that there is a form
>> field holding the value to be sent by ajax.
>>
>
> When calling ajax(), it is not necessary to send any data via a form field
> (the value of the second parameter can simply be an empty list).
>
>
>> So in your view you could just include in INPUT() helper somewhere on the
>> page and hide it via css.
>>
>
> Instead of doing that, when constructing the links themselves, just add
> the relevant id to the href URL -- the action called via Ajax can then pull
> the id from request.args.
>
>
>> 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');"
>>
>
> response.js is only used when a component is called via
> web2py_component(). If using the ajax() function with the ":eval" target,
> just return the Javascript directly:
>
> return '[your Javascript code]'
>
> Anthony
>