[Seaside] Generating an callback URL for third-party use

Esteban A. Maringolo emaringolo at gmail.com
Tue May 27 22:46:26 UTC 2014


I'm struggling to find a clean way of generating an url to be used for
external reference from a javascript library/plugin, such as
crossfilter or DataTables.

E.g the constructor configuration object has a dataUrl parameter,
which will be used by the plugin to retrieve the data.

$('element').plugin({dataUrl: "..."});

I can generate the expression to retrieve it from anywhere, but what I
want is to associate an url with a callback that will answer the data
requested.

Today I'm assigning results to a local variable using a predefined
callback function, and then initializing my data dependent function
assuming there is going to be data in that variable.

Ej:
html document addLoadScript: (
  ((html jQuery getJson
     json: [ :json | self renderItemsOnJson: json ];
     onSuccess: (JSStream on: 'myCallbackFunction(arguments[0]);')
asFunction) asFunction assignTo: 'loadCrossfilterData')).

html document addLoadScript: (JSStream on: 'loadCrossfilterData()').

I want some way to create a url callback in the way of:

callbackUrl :=  html magicalCallbackRegister: [ :json | self
renderItemsOnJson: json ]. "answers a url"

JSStream on: '$(''#element'').plugin({dataUrl:"', callbackUrl, '"})'.

which once rendered as JS would be:

$('#element').plugin({dataUrl:"/app/_s=...&_k=...&n"});

I know this must be possible, because Seaside does it for all the
callbacks, but I don't know how to create a simple callback and then
get it's url to pass it around.

I hope all I wrote is intelligible. Otherwise I can rephrase it in
other unintelligible way. :)

Esteban A. Maringolo


More information about the seaside mailing list