[Seaside] Re: a problem using javascript goto and jquery and some complex stuff

Johan Brichau johan at inceptive.be
Wed Nov 3 13:37:22 UTC 2010

Hi Esteban,

You can do that by putting the goto inside a script callback.

(I'm in a meeting right now, will reply with an example later)

On 03 Nov 2010, at 13:04, Esteban Lorenzano wrote:

> Hi,
> What I really want is to force a page refresh, but decide when this is necesary inside a javascript callback. For example, I open a "confirm dialog"... y you cancel the operation, nothing happens, but if you agree, a new page is rendered (not an ajax part, a whole new page), this is more or less the behavior I'm needing (something like the large example below).
> btw... I tryed using "html jQuery ajax" instead "html jQuery get" (and in fact I also tested with "post"), with exactly the same result for this issue.
> Cheers,
> Esteban
> On 2010-11-03 03:54:17 -0300, Johan Brichau <johan at inceptive.be> said:
>> Hi Esteban,
>> The goto makes your browser navigate to the url of an ajax callback.
>> That will execute the callback server-side but the response of that
>> callback is empty, hence the blank page. I think the use of #call: will
>> trigger a redirect in the callback, hence why that is working (just
>> writing this of the top of my head, did not verify). You either need to
>> use normal callbacks, or use jQuery to add or replace the html inline on
>> your webpage. Something along the lines of:
>> html anchor 		
>> 		onClick: (html jQuery ajax
>> 						callback:[self
>> doSomethingLikeRemoveARow];
>> 						onComplete:(html jQuery
>> ajax) script:[:s | s << ((s jQuery expression: 'body') append: [:r |
>> tabsComponent renderOn: r])  ]);
>> 		with: 'goto blah'.
>> -or-
>> html anchor 		
>> 		callback: [self doSomethingLikeRemoveARow. self show:
>> tabsComponent ];
>> 		with: 'goto blah'.
>> In the first case, it's important that you cancel the default behavior
>> of the anchor because otherwise it will execute a full callback instead
>> of an ajax request only. I'm always sending 'url: 'javascript:{}' to
>> such an anchor to cancel the default generated Seaside url, but there
>> are other ways.
>> Hope it helps
>> Johan
>> On 03 Nov 2010, at 01:09, Esteban Lorenzano wrote:
>>> Hi,
>>> I have a problem dealing with some ajax renderization... I have
>> something like this:
>>> 	html anchor 		onClick: (html javascript 			
>> goto: (html jQuery get 				callback: [ self show:
>> tabsComponent ];
>>> 				fullUrl));
>>> 		with: 'goto blah'.
>>> of course, this is not my real need, just a simplified version :)
>>> and whenever the callback is executed, it just renders a blank page...
>> but if I change the #show: for #call:, the new component is rendered
>> correctly... I think this is not correct, because same behavior is
>> happening in other contexts (for example, I want to execute a callback
>> after render a confirmation dialog, something like this:
>>> 	| dialogId |
>>> 	dialogId := html nextId. 	self canvas div id: dialogId.
>>> 	self canvas script: (html jQuery new dialog 		id:
>> dialogId;
>>> 		html: someComponent;
>>> 		title: 'Title;
>>> 		width: 600;
>>> 		addButton: 'Accept' do: (html javascript
>>> 			goto: (html jQuery get
>>> 				callback: [
>>> 					"This is fake code, but shows
>> what I need :)"
>>> 					self doSomethingLikeRemoveARow.
>>> 					self refreshReport ];
>>> 				fullUrl));
>>> 		addButton: 'Cancel' do: html jQuery new dialog close;
>>> 		resizable: false;
>>> 		modal: true
>>> 		autoOpen: true).
>>> again, this is a simplified version of something I do for reef, but it
>> shows more or less what I want... and I get a blank page all the time...
>>> Any idea how to solve this?
>>> Cheers,
>>> Esteban
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list