Plotkit and Ajax

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

Plotkit and Ajax

Karsten Kusche
Hi,

if I try to update a PlotKit element via Ajax-Updater the browser seems
to forget the functions that are defined in the response-html. The
result is that an error happens when these functions are called then.
The javascript that contains the functions is executed, but the
functions that are defined in this javascript are lost.

Does anyone know why this happens and how one could work around this
problem?

Kind Regards
Karsten


--
Karsten Kusche - Dipl.Inf. - [hidden email]
Tel: +49 3496 21 43 29
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

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

Re: Plotkit and Ajax

SebastianHC
Hi Karsten,

I had the same problem....
Have a look at plotr.

They solved the problem rendering an empty chart an updating the content
via the updater:

renderContentOn: html

    html render: lineChart.
   
    html script: (html updater
            id: lineChart ajaxId;
            every: 3 second;
            on: #renderChartOn: of: self)  


renderChartOn: html

     html script: lineChart ajaxUpdate


I used Seaside-Async before and as a result of this the rendering gets a
lot faster, because the rendering data isn't shown in the html source.
And flickering of the whole page exists any more, because just the chart
is redrawn...

Good Luck!
Sebastian

               
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

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

Re: Plotkit and Ajax

Gerhard Obermann
In reply to this post by Karsten Kusche
Hi!

Yes i had similar problems.
For me it seems to be a limitation of scriptaculous or even AJAX!

The only way i have found so far is to define the javascript functions outside of the Ajax Updater.
Anyway I think that it doesn't make sense to always define a function after each AJAX Response.

cheers
Gerhard



On Tue, Nov 4, 2008 at 6:14 PM, Karsten <[hidden email]> wrote:
Hi,

if I try to update a PlotKit element via Ajax-Updater the browser seems to forget the functions that are defined in the response-html. The result is that an error happens when these functions are called then. The javascript that contains the functions is executed, but the functions that are defined in this javascript are lost.

Does anyone know why this happens and how one could work around this problem?

Kind Regards
Karsten


--
Karsten Kusche - Dipl.Inf. - [hidden email]
Tel: +49 3496 21 43 29
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

RE: Plotkit and Ajax

Sebastian Sastre-2
In reply to this post by Karsten Kusche
Hi Karsten,

This is kind of expected to happen with all updateable components who define
behavior when page loads. If you for instance observe 'dom:loaded' and use that
to initialize the dom element somehow, you have to take care about updating it.

Every updater on one of those will create new instances (at dom) of the elements
so they could need to be initialized onComplete.
I actually don’t use onComplete for that because it happens too early. Instead I
set an #updated var to true for that element in the onComplete so it can be
initialized later.

That way, after rendering the element, the updater will execute the script (that
I've also set to be rendered in the updater callback) of that element and
(re)install behavior and (re)initialize that component. There you can do
whatever you need to hook events, set reactions, etc.

Cheers,

Sebastian Sastre
PD: with periodical is the same but periodically repetitive. But, it’s a pity
that Prototype's periodical hijacks onComplete for implementation and will
completely ignore your custom onComplete. This week I needed that and I had no
choice but to make my own periodical updater version which includes the
onComplete feature as anyone will expect.

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Karsten
> Enviado el: Martes, 04 de Noviembre de 2008 15:14
> Para: seaside-list
> Asunto: [Seaside] Plotkit and Ajax
>
> Hi,
>
> if I try to update a PlotKit element via Ajax-Updater the
> browser seems
> to forget the functions that are defined in the response-html. The
> result is that an error happens when these functions are called then.
> The javascript that contains the functions is executed, but the
> functions that are defined in this javascript are lost.
>
> Does anyone know why this happens and how one could work around this
> problem?
>
> Kind Regards
> Karsten
>
>
> --
> Karsten Kusche - Dipl.Inf. - [hidden email]
> Tel: +49 3496 21 43 29
> Georg Heeg eK - Köthen
> Handelsregister: Amtsgericht Dortmund A 12812
>
> _______________________________________________
> 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