Re: [web2py] Re: Removing a row from a list

2012-06-04 Thread Johann Spies
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread Cliff Kachinske
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread Anthony
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread Anthony
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
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

[web2py] Re: Removing a row from a list

2012-06-01 Thread Anthony
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.

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
ΟΚ, 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

[web2py] Re: Removing a row from a list

2012-06-01 Thread Cliff Kachinske
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