#updateUrl: and AJAX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

#updateUrl: and AJAX

Mariano Martinez Peck
Hi, 

I have an app where I have a root component which is the one being displayed almost all time. That component has a menu, a workspace where I can have many tabs, etc. Each of my use-case components can implement #needsServiceVM answering true or false. Depending on that, I must add a special field to the URL because then at web server level I do something different. 

Previously, my app was not using AJAX, so for example when I clicked on a menu and added a new tab, the #updateUrl: of my root component was called. Therefore in that method I could do something like:

updateUrl: aUrl 
super updateUrl: aUrl.
self workspaceComponentList anySatisfy: [ :workspace | 
(workspace activeTabPaneRenderable ifNil: [ false ]  ifNotNilDo: [ :tab | tab component needsServiceVM])
ifTrue: [ 
aUrl addField: 'service' value: 'true'. 
true ]
ifFalse: [ false ].
]  

The problem is now that the menus are fired by AJAX and the workspace is only re-render. Therefore, the clicked use-case component is added  as a new tab, but the #updateUrl:  of my root component was not called. 

Is there any workaround I could do? ajaxComplete  and somehow get the URL?

If it is not by adding a field in the URL do you have another possibility in mind? Maybe putting something in the request? (but I must be able to read this at the web server). 

Thanks in advance, 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #updateUrl: and AJAX

Gastón Dall' Oglio
Hi Mariano.

Once something similar happened to me, I had to render a component differences between a do in the full cycle or later with ajax call.
I could understand, is that if you look at the code WARenderPhaseContinuation>>processRendering: you'll see that along with rendering the component many other things are done, it is here that the "self updateURL becomes: actionURL" is performed. My impression was that all these tasks are not done when an ajax call is made, but I could not finish watching understand the code of Seaside at this low level...

If this were so, I would try to copy the code WARenderPhaseContinuation >> updateURL: and put it within my ajax call handler to force the update url (ie dirty I know but if it works ...).

(WAVisiblePresenterGuide client: (WAUpdateUrlVisitor url: aURL))
start: self session presenter

Best.

2014-12-19 13:33 GMT-03:00 Mariano Martinez Peck <[hidden email]>:
Hi, 

I have an app where I have a root component which is the one being displayed almost all time. That component has a menu, a workspace where I can have many tabs, etc. Each of my use-case components can implement #needsServiceVM answering true or false. Depending on that, I must add a special field to the URL because then at web server level I do something different. 

Previously, my app was not using AJAX, so for example when I clicked on a menu and added a new tab, the #updateUrl: of my root component was called. Therefore in that method I could do something like:

updateUrl: aUrl 
super updateUrl: aUrl.
self workspaceComponentList anySatisfy: [ :workspace | 
(workspace activeTabPaneRenderable ifNil: [ false ]  ifNotNilDo: [ :tab | tab component needsServiceVM])
ifTrue: [ 
aUrl addField: 'service' value: 'true'. 
true ]
ifFalse: [ false ].
]  

The problem is now that the menus are fired by AJAX and the workspace is only re-render. Therefore, the clicked use-case component is added  as a new tab, but the #updateUrl:  of my root component was not called. 

Is there any workaround I could do? ajaxComplete  and somehow get the URL?

If it is not by adding a field in the URL do you have another possibility in mind? Maybe putting something in the request? (but I must be able to read this at the web server). 

Thanks in advance, 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside