How to update XHTML with jQuery

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

How to update XHTML with jQuery

Damien Cassou
Hi,

I would like to reproduce
http://book.seaside.st/book/web-20/scriptaculous/ajax/updating using
Seaside 3.0 and jQuery but can't find the right invocation.

Could one please help me?

Thank you

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to update XHTML with jQuery

Paul DeBruicker
Damien Cassou wrote:
> Hi,
>
> I would like to reproduce
> http://book.seaside.st/book/web-20/scriptaculous/ajax/updating using
> Seaside 3.0 and jQuery but can't find the right invocation.


I think you replace this:

onChange: (html updater "<-- added"
                     id: 'items';
                     triggerForm: (html element up: 'form');
                     callback: [ :ajaxHtml | self renderItemsOn:
ajaxHtml ]);

with this:

onChange: (html jQuery ajax serializeThis;
        script: [:s | s << (s jQuery id: 'items') replaceWith: [:h | self
renderItemsOn: h]]);


but I am not able to test it to know for sure.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to update XHTML with jQuery

Gerhard Obermann
onChange: (html jQuery ajax serializeThis;
       script: [:s | s << (s jQuery id: 'items') replaceWith: [:h | self renderItemsOn: h]]);

doesn't work in that case, but the following should really work

 onChange: (((html jQuery: #items) load
                        serialize: (html jQuery this parents; find: 'form')) html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);

Gerhard



On Sat, Nov 28, 2009 at 7:59 PM, Paul DeBruicker <[hidden email]> wrote:
Damien Cassou wrote:
Hi,

I would like to reproduce
http://book.seaside.st/book/web-20/scriptaculous/ajax/updating using
Seaside 3.0 and jQuery but can't find the right invocation.


I think you replace this:

onChange: (html updater "<-- added"
                   id: 'items';
                   triggerForm: (html element up: 'form');
                   callback: [ :ajaxHtml | self renderItemsOn: ajaxHtml ]);

with this:

onChange: (html jQuery ajax serializeThis;
       script: [:s | s << (s jQuery id: 'items') replaceWith: [:h | self renderItemsOn: h]]);


but I am not able to test it to know for sure.

_______________________________________________
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: How to update XHTML with jQuery

Damien Cassou
On Sat, Nov 28, 2009 at 8:08 PM, Gerhard Obermann <[hidden email]> wrote:
>  onChange: (((html jQuery: #items) load
>                         serialize: (html jQuery this parents; find: 'form'))
>                         html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);

It works thank you. By manipulating your query, I was able to write
the following which still works and seems easier to read:

onChange: ((html jQuery: #items) load
                                serializeForm;
                                html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to update XHTML with jQuery

Lukas Renggli
>>  onChange: (((html jQuery: #items) load
>>                         serialize: (html jQuery this parents; find: 'form'))
>>                         html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);
>
> It works thank you. By manipulating your query, I was able to write
> the following which still works and seems easier to read:
>
> onChange: ((html jQuery: #items) load
>                                serializeForm;
>                                html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);

#serializeForm does serialize the closest form that surrounds the
current node (the element you set the #onChange:).

The code of Gerhard serializes all forms on the page, by enumerating
over all children of all parents of the current node. This is likely
very inefficient and could be replaced by

    html jQuery: 'form'

which should yield the same result.

Lukas

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