[Seaside] Jquery Ajax confirm: callback problem

jtuchel jtuchel at objektfabrik.de
Thu Jul 19 11:41:22 UTC 2012


I want to achieve the following:

In a list of objects you can click on one of them in order to delete it. I
want to show an ajax confirm dialog, which calls an ajax callback if the
user clicks on OK and then redraw the list.

The deletion will affect more than just an object not being in the list any
more, so I'd like to redraw the whole list once the object is deleted on the
server side.

So far, I've come up with this onClick: code: 

(s jQuery ajax
 confirm: 'Do you really want to delete this object?';
 callback: [self deleteObject: obj])
   onComplete: (
	s jQuery this load html: [:t | self renderListOn: t])

And it seems to work fine on Firefox, but not on Safari and Chrome (But
maybe it also is just a timing issue). It seems like the onComplete:
callback is being called as soon as the confirm: has completed, not after
the deletion on the server has finished. So on Chrome and Safari the redraw
is done too early and the object is still being rendered in the list.

So I need to wait with the #renderListOn: until  'callback: [self
deleteObject: obj]' has finished. 

So can somebody please 
* confirm that the way I try above is wrong and the onComplete is not
related to the confirm:'s callback?
* shed some light on how I would attach an onComplete callback to the result
of ' callback: [self deleteObject: obj])'

I guess it's simple, but I cannot find the right solution on my own...
Any help is appreciated.


View this message in context: http://forum.world.st/Jquery-Ajax-confirm-callback-problem-tp4640695.html
Sent from the Seaside General mailing list archive at Nabble.com.

More information about the seaside mailing list