Generating an URL for a callback

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

Generating an URL for a callback

ke.sackey@gmail.com
I've had the same problem before. The following code should work for returning the URL for a callback block:


>> callbackUrlFor: aBlock on: html
 | updater callbackKey url |  
 updater := html updater callback: aBlock.  
 callbackKey := html callbacks registerAjaxCallback: [updater process]. 
 url := html context actionUrl withParameter: callbackKey. 
 ^ url

Then you can use it in your render like this....

>> renderContentOn: html 

| callbackUrl |

callbackUrl := self callbackUrlFor: [:r | r text: 'Example!' ] on: html.

html anchor class: 'jTip'; id: 'element-id'; url: callbackUrl; with: 'Mouse over for tooltip'.



--
-------
K. Sackey

Cloud Nine


I'm porting an app to seaside that is using jTip
(http://www.codylindley.com/blogstuff/js/jtip/) to handle tooltips.
jTip works on links like the one below

<a id="element-id" class="jTip" href="/callback-url?width=450">Mouse
over for tooltip</a>

where callback-url will return the html to render as the tooltip. How
do I generate the callback-url?

Searching the archives, the closest I could find was a snippet like:

html updater
  callback: [ :r | r render: 'bar' ];
  url.

However, this just evaluates to http://localhost:8080/seaside/myapp

Any help would be appreciated.

Thanks,
Wilkes


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