On 1 June 2012 19:01, Anthony abasta...@gmail.com wrote:
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
This looks like a job for ajax.
Make a callback to the controller to delete the row using :eval. The
callback function returns a jquery code to delete the row from the page.
I would give you a link to the book, but I'm having problems going to
web2py.com.
On Friday, June 1, 2012 6:43:37 AM
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
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
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
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
a href='ajax('controller_function/{{=row.id}}', [], ':eval')X/a
That would have to be _onclick, not _href, and you'd want to add something
like ; return false at the end to prevent the usual link behavior.
Anyway, I suggested an alternative (in a separate post) that's a little
simpler.
ΟΚ, that's very helpful. Thanks once again.
On Friday, June 1, 2012 1:14:08 PM UTC-4, Anthony wrote:
a href='ajax('controller_function/{{=row.id}}', [], ':eval')X/a
That would have to be _onclick, not _href, and you'd want to add something
like ; return false at the end to prevent the
Based on this thread and an earlier one on the same topic, I think I'm
going to rework my index list pages something like this.
The link to the delete function will include the record id, index row
number of the record and number of rows on the page.
When the user clicks the delete button, the
9 matches
Mail list logo