SU updater or SU element - how to affect multiple elements?

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

SU updater or SU element - how to affect multiple elements?

Sophie424
I need to affect multiple elements (via html #update, or #element #hide,
#show). I know their IDs. How should I do this?

Thanks



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

Re: SU updater or SU element - how to affect multiple elements?

Lukas Renggli
> I need to affect multiple elements (via html #update, or #element #hide,
> #show). I know their IDs. How should I do this?

html evaluator callback: [ :s |
   s element id: 'first'; hide.
   s element id: 'second'; show ]

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: SU updater or SU element - how to affect multipleelements?

Sophie424
And that block is evaluated on a subsequent trip back on the server side?
Wow! This is amazing.

How do I chain these e.g. to get both a hide/show (with html evaluator) and
some DOM change (with html updater) from the same onClick?

Sophie.


"Lukas Renggli" <[hidden email]> wrote in message
news:[hidden email]...

>> I need to affect multiple elements (via html #update, or #element #hide,
>> #show). I know their IDs. How should I do this?
>
> html evaluator callback: [ :s |
>   s element id: 'first'; hide.
>   s element id: 'second'; show ]
>
> 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: SU updater or SU element - how to affectmultipleelements?

Sophie424

"itsme213" <[hidden email]> wrote in message
news:fjktgj$5bq$[hidden email]...
> And that block is evaluated on a subsequent trip back on the server side?
> Wow! This is amazing.
>
> How do I chain these e.g. to get both a hide/show (with html evaluator)
> and some DOM change (with html updater) from the same onClick?

Just tried the common sense thing with multiple onClicks and it works.
Please let me know if this is the correct way. This stuff is awesome.

Sophie




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

Re: SU updater or SU element - how to affect multiple elements?

keith1y
In reply to this post by Lukas Renggli
Lukas Renggli wrote:

>> I need to affect multiple elements (via html #update, or #element #hide,
>> #show). I know their IDs. How should I do this?
>>    
>
> html evaluator callback: [ :s |
>    s element id: 'first'; hide.
>    s element id: 'second'; show ]
>
> Lukas
>
>  
onClick: (

html evaluator callback: [ :script |
   script element id: 'first'; render: [ :r | self updateFirstOn: r ].
   script element id: 'second'; render: [ :r | self updateSecondOn: r ].
]

)

Keith




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

Re: SU updater or SU element - how to affectmultiple elements?

Sophie424

"Keith Hodges" <[hidden email]> wrote
> onClick: (
>
> html evaluator callback: [ :script |
>   script element id: 'first'; render: [ :r | self updateFirstOn: r ].
>   script element id: 'second'; render: [ :r | self updateSecondOn: r ].
> ]

Thanks, that clarifies it further. Would it also be OK to use multiple calls
to #onClick,
 html anchor
    onClick: ( self hideShowOn: html );
    onClick: (html updater
        id: opId;
            callback: [:r |
                 self toggleHideShowStateOnServer.
                 self renderBarOn: r])

or is that something to avoid? The generated Javascript gets appended
correctly, but perhaps there would be risky asynchronous / race between the
requests.

- Sophie



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

Re: Re: SU updater or SU element - how to affectmultiple elements?

Lukas Renggli
> Thanks, that clarifies it further. Would it also be OK to use multiple calls
> to #onClick,

If #hideShowOn: is an asynchronous updater, then you might be in
trouble. Ajax calls are asynchronous and are not guaranteed to be
handled in any particular order.

However if your actual code is something like this:

html anchor
    onClick: (html element id: opId; toggle);
    onClick: (html updater
        id: opId;
        callback: [:r |
            ...

then that's fine. The first action is not asynchronous. Therefor the
order is guaranteed.

Lukas

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