[Q] Conditional Updating Using Scriptaculous

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

[Q] Conditional Updating Using Scriptaculous

Chun, Sungjin
Hi,

To update element with id 'id', I can use html updater id:'id'; ... in scriptaculous.
But there're times that updating is not needed conditionally. For example,
div element "itemList" does have 1000+ sub element in itself and a link
for updating 'itemList' is clicked, but there's no new element added so updating
should not be done. (Doing update does not harm, but it takes 10+ seconds).

How can I do this, "updater with condition"?

Thank you in advance.

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

Re: [Q] Conditional Updating Using Scriptaculous

Lukas Renggli
> To update element with id 'id', I can use html updater id:'id'; ... in scriptaculous.
> But there're times that updating is not needed conditionally. For example,
> div element "itemList" does have 1000+ sub element in itself and a link
> for updating 'itemList' is clicked, but there's no new element added so updating
> should not be done. (Doing update does not harm, but it takes 10+ seconds).
>
> How can I do this, "updater with condition"?

As you say, you use a condition.

html updater
     id: 'somewhere';
     callback: [ :r | ... ];
     condition: ((html element
         id: 'id';
         childElements) size
             addDecoration: (SUBinary new operator: '<='; statement: 1000))

For the last line you maybe want to add some conveniance method to
SUObject, this looks a bit ulgy right now.

Generally for complicated JavaScript behavior it makes sense to write
the script in an editor and include it as an external file.

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: [Q] Conditional Updating Using Scriptaculous

Chun, Sungjin
In reply to this post by Chun, Sungjin
Wow, this is exactly what I want, thank you. hope there's a book
on Seaside+Scriptaculous...

Thank you very much, again.

----- Original Message -----
   From: Lukas Renggli <[hidden email]>
   To: [hidden email], Seaside - general discussion <[hidden email]>
   Sent: 08-01-12 18:24:18
   Subject: Re: [Seaside] [Q] Conditional Updating Using Scriptaculous

  > To update element with id 'id', I can use html updater id:'id'; ... in scriptaculous.
> But there're times that updating is not needed conditionally. For example,
> div element "itemList" does have 1000+ sub element in itself and a link
> for updating 'itemList' is clicked, but there's no new element added so updating
> should not be done. (Doing update does not harm, but it takes 10+ seconds).
>
> How can I do this, "updater with condition"?

As you say, you use a condition.

html updater
     id: 'somewhere';
     callback: [ :r | ... ];
     condition: ((html element
         id: 'id';
         childElements) size
             addDecoration: (SUBinary new operator: '<='; statement: 1000))

For the last line you maybe want to add some conveniance method to
SUObject, this looks a bit ulgy right now.

Generally for complicated JavaScript behavior it makes sense to write
the script in an editor and include it as an external file.

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: [Q] Conditional Updating Using Scriptaculous

Sebastian Sastre-2
In reply to this post by Lukas Renggli

> Generally for complicated JavaScript behavior it makes sense
> to write the script in an editor and include it as an external file.
>
> Lukas
>
I added a lot of conveniences like that and still making javascript from the
image instead of external file. It allows me to do a kind of hierarchy in
DOM element just because it's behavior is defined in the the smalltalk
components hierarchy. Javascript programed from smalltalk a very crazy but
cool thing to have.

Cheers,

Sebastian

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