Scriptalicious

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

Scriptalicious

Ramon Leon-5
Hi, anyone know a way to update multiple elements on a page with a single
ajax callback?

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

Re: Scriptalicious

Sylvain pralon
you can put several callback to the canvas element for example :

renderer anchor
          onClick: (html updater ....);
          onClick: (html updater ....);
          onStuff:.....;
          with:[html text:'aaaa']

for me it works.

hope this helps

sylvain pralon

2006/7/24, Ramon Leon <[hidden email]>:
Hi, anyone know a way to update multiple elements on a page with a single
ajax callback?

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



--
*********************************************
Sylvain Pralon
Etudiant Genie Logiciel et Services
Ecole Supérieure d'Ingénieurs d'Annecy

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

RE: Scriptalicious

Ramon Leon-5
>
> you can put several callback to the canvas element for example :
>
> renderer anchor
>           onClick: (html updater ....);
>           onClick: (html updater ....);
>           onStuff:.....;
>           with:[html text:'aaaa']
>
> for me it works.
>
> hope this helps
>
> sylvain pralon

You misunderstand my question, that's multiple calls updating a single dom
element, I want the opposite, one call updating multiple dom elements.

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

Re: Scriptalicious

Darius Clarke
Is Comet or Asteroid what you need?
http://map.squeak.org/package/b33c680e-5f7e-41e3-98b9-d84324fa2587

Cheers,
Darius

On 7/25/06, Ramon Leon <[hidden email]> wrote:
>

> you can put several callback to the canvas element for example :
>
> renderer anchor
>           onClick: (html updater ....);
>           onClick: (html updater ....);
>           onStuff:.....;
>           with:[html text:'aaaa']
>
> for me it works.
>
> hope this helps
>
> sylvain pralon

You misunderstand my question, that's multiple calls updating a single dom
element, I want the opposite, one call updating multiple dom elements.

_______________________________________________
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: Scriptalicious

Darius Clarke
Also check out:
http://lists.squeakfoundation.org/pipermail/seaside/2006-April/007388.html

On 7/25/06, Darius Clarke <[hidden email]> wrote:

>
> Is Comet or Asteroid what you need?
> http://map.squeak.org/package/b33c680e-5f7e-41e3-98b9-d84324fa2587
>
> Cheers,
>
> Darius
>
>
>
>  On 7/25/06, Ramon Leon <[hidden email]> wrote:
> >  >
> > > you can put several callback to the canvas element for example :
> > >
> > > renderer anchor
> > >           onClick: (html updater ....);
> > >           onClick: (html updater ....);
> > >           onStuff:.....;
> > >           with:[html text:'aaaa']
> > >
> > > for me it works.
> > >
> > > hope this helps
> > >
> > > sylvain pralon
> >
> > You misunderstand my question, that's multiple calls updating a single dom
> >  element, I want the opposite, one call updating multiple dom elements.
> >
> > _______________________________________________
> > 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: Scriptalicious

Ramon Leon-5
In reply to this post by Darius Clarke
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf
> Of Darius Clarke
> Sent: Tuesday, July 25, 2006 1:13 PM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: Re: [Seaside] Scriptalicious
>
> Is Comet or Asteroid what you need?
> http://map.squeak.org/package/b33c680e-5f7e-41e3-98b9-d84324fa2587
>
> Cheers,
> Darius

No, that's a streaming update, entirely different concept, but thanks
anyway.

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

Re: Scriptalicious

Lukas Renggli
In reply to this post by Ramon Leon-5
> Hi, anyone know a way to update multiple elements on a page with a single
> ajax callback?

Yes, this is possible, but the approach is slightly different. I am on
holidays right now and have no computer with a Squeak image ready but
something like the following code should work. If you can`t make it
run within a week, I will be able to provide a tested example ...

html anchor
   onClick: (html evaluator
      callback: [ :script |
         script add: (script element id: 'id1'; update: 'bla bla').
         script add: (script effect id: 'id1'; appear).
         script add: (script element id: 'id2'; update: 'bla bla bla').
      ]

Basically the idea is to inject a script into the existing web-site
with the evaluator. I think in the latest version of scriptaculous
there is an example with an Accordeon Component that does exactly
this, but I am not entirely sure.

Cheers,
Lukas

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

Re: Scriptalicious

Sophie424
In reply to this post by Ramon Leon-5

----- Original Message -----
From: "Ramon Leon" <[hidden email]>
To: "'The Squeak Enterprise Aubergines Server - general discussion.'"
<[hidden email]>
Sent: Tuesday, July 25, 2006 10:33 AM
Subject: RE: [Seaside] Scriptalicious


>>
>> you can put several callback to the canvas element for example :
>>
>> renderer anchor
>>           onClick: (html updater ....);
>>           onClick: (html updater ....);
>>           onStuff:.....;
>>           with:[html text:'aaaa']
>>
>> for me it works.
>>
>> hope this helps
>>
>> sylvain pralon
>
> You misunderstand my question, that's multiple calls updating a single dom
> element, I want the opposite, one call updating multiple dom elements.


I'd like to do this as well. Seems like it needs a way to separate the
action to execute (e.g. onclick) and a corresponding SET of pairs of <id,
re-rendering code>. But I'm not sure how to do that.

Would it make sense if the decision of which components to update was made
by some event machinery that tied components to domain objects and detected
'dirty' components?

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

Re: Re: Scriptalicious

Lukas Renggli
> Would it make sense if the decision of which components to update was made
> by some event machinery that tied components to domain objects and detected
> 'dirty' components?

Yes, I once wrote a prototype of something like that for a commercial
project, but it is much trickier than it sounds like, at least for
more sophisticated cases.

The major problem is that the id of the <id, render-code> pair is
dynamic, that is it might change, appear, disappear over the livecycle
of a page. Then the order in which those updates should be evaluated
is not given with a set of <id, render-code> pairs, but the order
might matter for the resulting page.

Maybe I am just thinking too generic? Maybe anyone has an idea how
this problem could be reduced so that we can implement a subset of the
requested functionality?

Cheers,
Lukas

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

RE: Scriptalicious

Ramon Leon-5
In reply to this post by Lukas Renggli
> > Hi, anyone know a way to update multiple elements on a page with a
> > single ajax callback?
>
> Yes, this is possible, but the approach is slightly
> different. I am on holidays right now and have no computer
> with a Squeak image ready but something like the following
> code should work. If you can`t make it run within a week, I
> will be able to provide a tested example ...
>
> html anchor
>    onClick: (html evaluator
>       callback: [ :script |
>          script add: (script element id: 'id1'; update: 'bla bla').
>          script add: (script effect id: 'id1'; appear).
>          script add: (script element id: 'id2'; update: 'bla
> bla bla').
>       ]
>
> Basically the idea is to inject a script into the existing
> web-site with the evaluator. I think in the latest version of
> scriptaculous there is an example with an Accordeon Component
> that does exactly this, but I am not entirely sure.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch

Hmm... this almost works.  It does update multiple elements, but it's a bit
too simple to do what I need.  Here's kind of what I'm trying to do, syntax
just made up for second add...

html script: (html evaluator
    callback: [ :script |
        script add: (script element id: 'id1'; update: 'price here').
        script add: (script element id: 'id2';
            render: [:r |
                self allPrices do:[:each |
                    r text: each.
                    r anchor callback:[self bookRate: each]; text: 'book
rate']])])

Ok, updating the first element, simple text content, works great, but
updating the second element, need to insert multiple child elements with
anchors and callbacks, need a rendering context, can't figure this one out.
Any ideas?





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

RE: Scriptalicious

Ramon Leon-5
> Hmm... this almost works.  It does update multiple elements,
> but it's a bit too simple to do what I need.  Here's kind of
> what I'm trying to do, syntax just made up for second add...
>
> html script: (html evaluator
>     callback: [ :script |
>         script add: (script element id: 'id1'; update: 'price here').
>         script add: (script element id: 'id2';
>             render: [:r |
>                 self allPrices do:[:each |
>                     r text: each.
>                     r anchor callback:[self bookRate: each];
> text: 'book
> rate']])])
>
> Ok, updating the first element, simple text content, works
> great, but updating the second element, need to insert
> multiple child elements with anchors and callbacks, need a
> rendering context, can't figure this one out.
> Any ideas?

Lucas, any suggestions about this?

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

Re: RE: Scriptalicious

Lukas Renggli
Sorry for not replaying earlier, I flagged your mail but I simply had
no time to answer.

> > Hmm... this almost works.  It does update multiple elements,
> > but it's a bit too simple to do what I need.  Here's kind of
> > what I'm trying to do, syntax just made up for second add...
> >
> > html script: (html evaluator
> >     callback: [ :script |
> >         script add: (script element id: 'id1'; update: 'price here').
> >         script add: (script element id: 'id2';
> >             render: [:r |
> >                 self allPrices do:[:each |
> >                     r text: each.
> >                     r anchor callback:[self bookRate: each];
> > text: 'book
> > rate']])])
> >
> > Ok, updating the first element, simple text content, works
> > great, but updating the second element, need to insert
> > multiple child elements with anchors and callbacks, need a
> > rendering context, can't figure this one out.
> > Any ideas?
>
> Lucas, any suggestions about this?

Mhh, I don't understand your code. Did you implement a method #render:
in SUElement or is this some old code of mine?

I am a bit puzzled, the latest version of scriptaculous seems to be a
bit buggy. I'll definitely have to have a look at it tomorrow.

Lukas

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

RE: RE: Scriptalicious

Ramon Leon-5
> Sorry for not replaying earlier, I flagged your mail but I
> simply had no time to answer.
>
> > > Hmm... this almost works.  It does update multiple elements, but
> > > it's a bit too simple to do what I need.  Here's kind of what I'm
> > > trying to do, syntax just made up for second add...
> > >
> > > html script: (html evaluator
> > >     callback: [ :script |
> > >         script add: (script element id: 'id1'; update:
> 'price here').
> > >         script add: (script element id: 'id2';
> > >             render: [:r |
> > >                 self allPrices do:[:each |
> > >                     r text: each.
> > >                     r anchor callback:[self bookRate: each];
> > > text: 'book
> > > rate']])])
> > >
> > > Ok, updating the first element, simple text content, works great,
> > > but updating the second element, need to insert multiple child
> > > elements with anchors and callbacks, need a rendering
> context, can't
> > > figure this one out.
> > > Any ideas?
> >
> > Lucas, any suggestions about this?
>
> Mhh, I don't understand your code. Did you implement a method #render:
> in SUElement or is this some old code of mine?
>
> I am a bit puzzled, the latest version of scriptaculous seems
> to be a bit buggy. I'll definitely have to have a look at it tomorrow.
>
> Lukas

No no, I made up the render as an example of what I wanted to do, rather
than call update: with a string, I want a rendering context so I can render
a bunch of child elements into the element I'm updating.  I don't know how
to do it, just wondering if that's possible somehow?  Your multiple update
sample worked, it was just too simple for what I needed.

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

Re: RE: RE: Scriptalicious

Lukas Renggli
> No no, I made up the render as an example of what I wanted to do, rather
> than call update: with a string, I want a rendering context so I can render
> a bunch of child elements into the element I'm updating.  I don't know how
> to do it, just wondering if that's possible somehow?  Your multiple update
> sample worked, it was just too simple for what I needed.

Aha, I see. You might want to try something like this, not very simple
but it should at least do what you need:

script add: (script element
    id: 'id2';
    update: (String streamContents: [ :s |
         script
             render: [:r |
                 self allPrices do:[:each |
                   r text: each.
                   r anchor callback:[self bookRate: each] ]
              on: s)

The method used #render:on: is an ugly utility function defined in
SUObject returning the rendered string.

HTH,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside