[Seaside] Creating a component that requires a callback:
Gerardo Richarte
gera at corest.com
Fri Nov 21 15:14:30 UTC 2008
Hi, I'm pretty new to seaside, and it's only parttime, but well, I'm
anyway trying to implement some sort of AMChartsComponent
(www.amcharts.com) (I find it nicer and better than PlotKit)
It should't be tricky, however, two things are making my process very slow:
I have the flash component rendered already, with some javascript code
to configure it, however, one of the arguments I need to supply to a
javascript call is a URL to an XML file. Maybe I can make this XML file
be static, and then use AMChartsLibrary / #something, but maybe I need
to dynamically create this XML, and hence I want to have some sort of
callback: mechanism, so Seaside creates a dynamic URL, and the block
answers with the XML. My question is, how do I create a component like
this? suppose my renderContentOn: today looks something like:
html script: 'doSomethingRequiringURL("http://localhost/seaside/blah");'
I guess I could somehow turn it into:
html script: 'doSomethingRequiringURL(', (AMChartLibrary /
#lahpreparedXML) asJavascript, ');'
but I'd really like to do something more like
html amchart
settings: [:xml | xml blah...]
for example.
And then, inside this XML there is another URL, that points to the data
source to plot. I'm still not sure how the interface to all this will
look like, but I certainly want this URL to again, be generated dinamically.
so, a couple of questions.
. How do I create a component that uses something like the callback
mechanism? (how do I get seaside to generate the URL for me and do all
its magic)
. Do you have any design ideas on how I should better implement this? I
guess I'll try to follow how PlotKit is used, so the interfaces to the
two are somehow compatible.
Right now I only want a quick hack, but eventually, if this finally
works and I somehow like it, I'll contribute it... of course, if
somebody has already done it, I'm more than willing to reuse :)
thanks!
richie
More information about the seaside
mailing list