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 jquery will lock out the 
navigation links and send an ajax callback to the controller.

The ajax call back will delete the record, then fetch the succeeding 
records to fill the page.  The returned javascript will rewrite the index 
list from the deleted row to the end, update any page count or row count 
indicators and unlock navigation.

It seems to me like that's the best combination of agile user experience 
and accurately representing the state of the database.

The only thing left out is notifications/refreshes if another user deletes 
one of the records on the page.  I suppose the way to do that is for the 
browser to periodically ping the server ...

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 usual link behavior. 
> Anyway, I suggested an alternative (in a separate post) that's a little 
> simpler.
>
> I'm just not quite sure what you mean that "response.js is only used when 
>> a component is called via web2py_component()." 
>>
>
> Let's say you have a function "myfunc" and you call it via 
> web2py_component() (possibly via the LOAD() helper, or directly). In that 
> case, the myfunc function can set response.js, and when it returns its 
> response, the Javascript code in response.js will get executed on the 
> client. However, if you call myfunc using the ajax() function with the 
> target set to ":eval", the myfunc function should not set response.js, as 
> it will not be executed on the client in that case. Instead, myfunc should 
> just return the Javascript directly, and the ":eval" target will tell the 
> browser to execute that returned response as Javascript.
>
> Anthony
>

Reply via email to