inter component communication using AJAX

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

inter component communication using AJAX

squeakman
Hello All,

I have a component "A" that contains two children components "B" and "C".

The code in B that looks like:
      html select .....
      onClick: (html scriptaculous updater id: 'C';
                callback: [:r | (r element id: 'C') hide])

clicking on an item in the select list in B causes C to be hidden.  This
works but it ties B to C.

Is there a way to do this without having B know about C?  I would like
to have the parent A do the hiding of C but I cannot figure out how to
do this.

Sorry if this is too cryptic, including all the code was just too messy.

Thanks,

Frank

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

Re: inter component communication using AJAX

patmaddox
try announcements. it's in the pharo book


On Sep 27, 2011, at 3:50 PM, squeakman wrote:

> Hello All,
>
> I have a component "A" that contains two children components "B" and "C".
>
> The code in B that looks like:
>     html select .....
>     onClick: (html scriptaculous updater id: 'C';
>               callback: [:r | (r element id: 'C') hide])
>
> clicking on an item in the select list in B causes C to be hidden.  This works but it ties B to C.
>
> Is there a way to do this without having B know about C?  I would like to have the parent A do the hiding of C but I cannot figure out how to do this.
>
> Sorry if this is too cryptic, including all the code was just too messy.
>
> Thanks,
>
> Frank
>
> _______________________________________________
> 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: inter component communication using AJAX

Robert Sirois
In reply to this post by squeakman
Have B tell A something then and let A deal with it how it wants and return the ajax call with some javascript update to the DOM.

The children scheme doesn't matter as much with ajax calls unless you're keeping state in case the user reloads the page or something.

RS

> To: seaside@lists.squeakfoundation.org
> From: squeakman@gmail.com
> Date: Tue, 27 Sep 2011 18:50:19 -0400
> Subject: [Seaside] inter component communication using AJAX
>
> Hello All,
>
> I have a component "A" that contains two children components "B" and "C".
>
> The code in B that looks like:
> html select .....
> onClick: (html scriptaculous updater id: 'C';
> callback: [:r | (r element id: 'C') hide])
>
> clicking on an item in the select list in B causes C to be hidden. This
> works but it ties B to C.
>
> Is there a way to do this without having B know about C? I would like
> to have the parent A do the hiding of C but I cannot figure out how to
> do this.
>
> Sorry if this is too cryptic, including all the code was just too messy.
>
> Thanks,
>
> Frank
>
> _______________________________________________
> seaside mailing list
> seaside@lists.squeakfoundation.org
> 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: inter component communication using AJAX

squeakman
On 27/09/2011 7:04 PM, Robert Sirois wrote:
> Have B tell A something then and let A deal with it how it wants and
> return the ajax call with some javascript update to the DOM.
>
This is what I am trying to do but cannot figure it out.  I have "B"
pass the renderer "r" to A - but I cannot figure out how to use that
rendered to do a search for element "C".

I see methods in PTElement for up, down, next but nothing that would
allow me to search for some arbitrary element in the DOM.

My knowledge of Javascript is not great so I am struggling.



> The children scheme doesn't matter as much with ajax calls unless you're
> keeping state in case the user reloads the page or something.
>
> RS
>
>  > To: [hidden email]
>  > From: [hidden email]
>  > Date: Tue, 27 Sep 2011 18:50:19 -0400
>  > Subject: [Seaside] inter component communication using AJAX
>  >
>  > Hello All,
>  >
>  > I have a component "A" that contains two children components "B" and "C".
>  >
>  > The code in B that looks like:
>  > html select .....
>  > onClick: (html scriptaculous updater id: 'C';
>  > callback: [:r | (r element id: 'C') hide])
>  >
>  > clicking on an item in the select list in B causes C to be hidden. This
>  > works but it ties B to C.
>  >
>  > Is there a way to do this without having B know about C? I would like
>  > to have the parent A do the hiding of C but I cannot figure out how to
>  > do this.
>  >
>  > Sorry if this is too cryptic, including all the code was just too messy.
>  >
>  > Thanks,
>  >
>  > Frank
>  >
>  > _______________________________________________
>  > 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


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

Re: inter component communication using AJAX

Johan Brichau-2
I'm not sure what exactly the problem is you are trying to deal with, but it vaguely seems you are trying to accomplish something I have described here: http://johanbrichau.blogspot.com/2011/09/ajaxified-seaside-components.html

In addition, take a look at jQuery (for client-side DOM navigation) and Announcements (for server-side component coordination)

Maybe it helps, maybe not…  I'm glad to answer any questions you might have if this describes what you are looking for.

Cheers
Johan


On 28 Sep 2011, at 03:55, squeakman wrote:

> On 27/09/2011 7:04 PM, Robert Sirois wrote:
>> Have B tell A something then and let A deal with it how it wants and
>> return the ajax call with some javascript update to the DOM.
>>
> This is what I am trying to do but cannot figure it out.  I have "B" pass the renderer "r" to A - but I cannot figure out how to use that rendered to do a search for element "C".
>
> I see methods in PTElement for up, down, next but nothing that would allow me to search for some arbitrary element in the DOM.
>
> My knowledge of Javascript is not great so I am struggling.
>
>
>
>> The children scheme doesn't matter as much with ajax calls unless you're
>> keeping state in case the user reloads the page or something.
>>
>> RS
>>
>> > To: [hidden email]
>> > From: [hidden email]
>> > Date: Tue, 27 Sep 2011 18:50:19 -0400
>> > Subject: [Seaside] inter component communication using AJAX
>> >
>> > Hello All,
>> >
>> > I have a component "A" that contains two children components "B" and "C".
>> >
>> > The code in B that looks like:
>> > html select .....
>> > onClick: (html scriptaculous updater id: 'C';
>> > callback: [:r | (r element id: 'C') hide])
>> >
>> > clicking on an item in the select list in B causes C to be hidden. This
>> > works but it ties B to C.
>> >
>> > Is there a way to do this without having B know about C? I would like
>> > to have the parent A do the hiding of C but I cannot figure out how to
>> > do this.
>> >
>> > Sorry if this is too cryptic, including all the code was just too messy.
>> >
>> > Thanks,
>> >
>> > Frank
>> >
>> > _______________________________________________
>> > 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
>
>
> _______________________________________________
> 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: inter component communication using AJAX

squeakman
Hi Johan,

I loaded your code from Monticello. The only way I could figure out how
to run it was to add the following:

AjaxifiedCounterPage class>>initialize
        "self initialize"
        WAAdmin register: self asApplicationAt: 'AjaxifiedCounterPage'

This allowed me to run it from the Dispatcher.

It paints the page of counters but the '+' does not appear to work (I
added a breakpoint in the callback for the '+' and it is never
triggered).  The '-' works fine.

And yes, I am trying to do what you described in your blog and I would
love to be able to use it.

Thanks,
Frank


On 28/09/2011 4:13 AM, Johan Brichau wrote:

> I'm not sure what exactly the problem is you are trying to deal with, but it vaguely seems you are trying to accomplish something I have described here: http://johanbrichau.blogspot.com/2011/09/ajaxified-seaside-components.html
>
> In addition, take a look at jQuery (for client-side DOM navigation) and Announcements (for server-side component coordination)
>
> Maybe it helps, maybe not…  I'm glad to answer any questions you might have if this describes what you are looking for.
>
> Cheers
> Johan
>
>

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

Re: inter component communication using AJAX

Gastón Dall' Oglio
In reply to this post by Johan Brichau-2
Hi Johan.

I don't sure if are a bug in ss3, but in the page http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents.html the snippet code is wrong?
I have to change #repository: to #url: for correctly load.

from 

Gofer new
repository: 'http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents';
package: 'AjaxifiedComponents-Core';
package: 'AjaxifiedComponents-Example';
load

to

Gofer new
url: 'http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents';
package: 'AjaxifiedComponents-Core';
package: 'AjaxifiedComponents-Example';
load



2011/9/28 Johan Brichau <[hidden email]>
I'm not sure what exactly the problem is you are trying to deal with, but it vaguely seems you are trying to accomplish something I have described here: http://johanbrichau.blogspot.com/2011/09/ajaxified-seaside-components.html

In addition, take a look at jQuery (for client-side DOM navigation) and Announcements (for server-side component coordination)

Maybe it helps, maybe not…  I'm glad to answer any questions you might have if this describes what you are looking for.

Cheers
Johan


On 28 Sep 2011, at 03:55, squeakman wrote:

> On 27/09/2011 7:04 PM, Robert Sirois wrote:
>> Have B tell A something then and let A deal with it how it wants and
>> return the ajax call with some javascript update to the DOM.
>>
> This is what I am trying to do but cannot figure it out.  I have "B" pass the renderer "r" to A - but I cannot figure out how to use that rendered to do a search for element "C".
>
> I see methods in PTElement for up, down, next but nothing that would allow me to search for some arbitrary element in the DOM.
>
> My knowledge of Javascript is not great so I am struggling.
>
>
>
>> The children scheme doesn't matter as much with ajax calls unless you're
>> keeping state in case the user reloads the page or something.
>>
>> RS
>>
>> > To: [hidden email]
>> > From: [hidden email]
>> > Date: Tue, 27 Sep 2011 18:50:19 -0400
>> > Subject: [Seaside] inter component communication using AJAX
>> >
>> > Hello All,
>> >
>> > I have a component "A" that contains two children components "B" and "C".
>> >
>> > The code in B that looks like:
>> > html select .....
>> > onClick: (html scriptaculous updater id: 'C';
>> > callback: [:r | (r element id: 'C') hide])
>> >
>> > clicking on an item in the select list in B causes C to be hidden. This
>> > works but it ties B to C.
>> >
>> > Is there a way to do this without having B know about C? I would like
>> > to have the parent A do the hiding of C but I cannot figure out how to
>> > do this.
>> >
>> > Sorry if this is too cryptic, including all the code was just too messy.
>> >
>> > Thanks,
>> >
>> > Frank
>> >
>> > _______________________________________________
>> > 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
>
>
> _______________________________________________
> 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


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

Re: inter component communication using AJAX

Dale Henrichs
Gastón,

That is a known bug in SS3[1].

Thanks for the report.

Dale

[1] http://code.google.com/p/squeaksource3/issues/detail?id=20

----- Original Message -----
| From: "Gastón Dall' Oglio" <[hidden email]>
| To: "Seaside - general discussion" <[hidden email]>
| Sent: Wednesday, September 28, 2011 11:29:33 AM
| Subject: Re: [Seaside] inter component communication using AJAX
|
|
|
| Hi Johan.
|
|
|
| I don't sure if are a bug in ss3, but in the page
| http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents.html the
| snippet code is wrong?
| I have to change #repository: to #url: for correctly load.
|
|
| from
|
|
| Gofer new
| repository: ' http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents
| ';
| package: 'AjaxifiedComponents-Core';
| package: 'AjaxifiedComponents-Example';
| load
|
|
| to
|
|
| Gofer new
| url: ' http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents ';
| package: 'AjaxifiedComponents-Core';
| package: 'AjaxifiedComponents-Example';
| load
|
|
|
|
|
|
| 2011/9/28 Johan Brichau < [hidden email] >
|
|
| I'm not sure what exactly the problem is you are trying to deal with,
| but it vaguely seems you are trying to accomplish something I have
| described here:
| http://johanbrichau.blogspot.com/2011/09/ajaxified-seaside-components.html
|
| In addition, take a look at jQuery (for client-side DOM navigation)
| and Announcements (for server-side component coordination)
|
| Maybe it helps, maybe not… I'm glad to answer any questions you might
| have if this describes what you are looking for.
|
| Cheers
| Johan
|
|
|
|
| On 28 Sep 2011, at 03:55, squeakman wrote:
|
| > On 27/09/2011 7:04 PM, Robert Sirois wrote:
| >> Have B tell A something then and let A deal with it how it wants
| >> and
| >> return the ajax call with some javascript update to the DOM.
| >>
| > This is what I am trying to do but cannot figure it out. I have "B"
| > pass the renderer "r" to A - but I cannot figure out how to use
| > that rendered to do a search for element "C".
| >
| > I see methods in PTElement for up, down, next but nothing that
| > would allow me to search for some arbitrary element in the DOM.
| >
| > My knowledge of Javascript is not great so I am struggling.
| >
| >
| >
| >> The children scheme doesn't matter as much with ajax calls unless
| >> you're
| >> keeping state in case the user reloads the page or something.
| >>
| >> RS
| >>
| >> > To: [hidden email]
| >> > From: [hidden email]
| >> > Date: Tue, 27 Sep 2011 18:50:19 -0400
| >> > Subject: [Seaside] inter component communication using AJAX
| >> >
| >> > Hello All,
| >> >
| >> > I have a component "A" that contains two children components "B"
| >> > and "C".
| >> >
| >> > The code in B that looks like:
| >> > html select .....
| >> > onClick: (html scriptaculous updater id: 'C';
| >> > callback: [:r | (r element id: 'C') hide])
| >> >
| >> > clicking on an item in the select list in B causes C to be
| >> > hidden. This
| >> > works but it ties B to C.
| >> >
| >> > Is there a way to do this without having B know about C? I would
| >> > like
| >> > to have the parent A do the hiding of C but I cannot figure out
| >> > how to
| >> > do this.
| >> >
| >> > Sorry if this is too cryptic, including all the code was just
| >> > too messy.
| >> >
| >> > Thanks,
| >> >
| >> > Frank
| >> >
| >> > _______________________________________________
| >> > 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
| >
| >
| > _______________________________________________
| > 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
|
|
| _______________________________________________
| 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: inter component communication using AJAX

recursive
In reply to this post by squeakman
You need to add the relevant JS libraries in the seaside configuration of the example application for it to work:

JQUIDevelopmentLibrary
JQDevelopmentLibrary



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

Re: inter component communication using AJAX

Gastón Dall' Oglio
In reply to this post by Dale Henrichs
Dale, you're welcome.


2011/9/28 Dale Henrichs <[hidden email]>
Gastón,

That is a known bug in SS3[1].

Thanks for the report.

Dale

[1] http://code.google.com/p/squeaksource3/issues/detail?id=20

----- Original Message -----
| From: "Gastón Dall' Oglio" <[hidden email]>
| To: "Seaside - general discussion" <[hidden email]>
| Sent: Wednesday, September 28, 2011 11:29:33 AM
| Subject: Re: [Seaside] inter component communication using AJAX
|
|
|
| Hi Johan.
|
|
|
| I don't sure if are a bug in ss3, but in the page
| http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents.html the
| snippet code is wrong?
| I have to change #repository: to #url: for correctly load.
|
|
| from
|
|
| Gofer new
| repository: ' http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents
| ';
| package: 'AjaxifiedComponents-Core';
| package: 'AjaxifiedComponents-Example';
| load
|
|
| to
|
|
| Gofer new
| url: ' http://ss3.gemstone.com/ss/SeasideAjaxifiedComponents ';
| package: 'AjaxifiedComponents-Core';
| package: 'AjaxifiedComponents-Example';
| load
|
|
|
|
|
|
| 2011/9/28 Johan Brichau < [hidden email] >
|
|
| I'm not sure what exactly the problem is you are trying to deal with,
| but it vaguely seems you are trying to accomplish something I have
| described here:
| http://johanbrichau.blogspot.com/2011/09/ajaxified-seaside-components.html
|
| In addition, take a look at jQuery (for client-side DOM navigation)
| and Announcements (for server-side component coordination)
|
| Maybe it helps, maybe not… I'm glad to answer any questions you might
| have if this describes what you are looking for.
|
| Cheers
| Johan
|
|
|
|
| On 28 Sep 2011, at 03:55, squeakman wrote:
|
| > On 27/09/2011 7:04 PM, Robert Sirois wrote:
| >> Have B tell A something then and let A deal with it how it wants
| >> and
| >> return the ajax call with some javascript update to the DOM.
| >>
| > This is what I am trying to do but cannot figure it out. I have "B"
| > pass the renderer "r" to A - but I cannot figure out how to use
| > that rendered to do a search for element "C".
| >
| > I see methods in PTElement for up, down, next but nothing that
| > would allow me to search for some arbitrary element in the DOM.
| >
| > My knowledge of Javascript is not great so I am struggling.
| >
| >
| >
| >> The children scheme doesn't matter as much with ajax calls unless
| >> you're
| >> keeping state in case the user reloads the page or something.
| >>
| >> RS
| >>
| >> > To: [hidden email]
| >> > From: [hidden email]
| >> > Date: Tue, 27 Sep 2011 18:50:19 -0400
| >> > Subject: [Seaside] inter component communication using AJAX
| >> >
| >> > Hello All,
| >> >
| >> > I have a component "A" that contains two children components "B"
| >> > and "C".
| >> >
| >> > The code in B that looks like:
| >> > html select .....
| >> > onClick: (html scriptaculous updater id: 'C';
| >> > callback: [:r | (r element id: 'C') hide])
| >> >
| >> > clicking on an item in the select list in B causes C to be
| >> > hidden. This
| >> > works but it ties B to C.
| >> >
| >> > Is there a way to do this without having B know about C? I would
| >> > like
| >> > to have the parent A do the hiding of C but I cannot figure out
| >> > how to
| >> > do this.
| >> >
| >> > Sorry if this is too cryptic, including all the code was just
| >> > too messy.
| >> >
| >> > Thanks,
| >> >
| >> > Frank
| >> >
| >> > _______________________________________________
| >> > 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
| >
| >
| > _______________________________________________
| > 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
|
|
| _______________________________________________
| 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


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

Re: inter component communication using AJAX

Johan Brichau-2
In reply to this post by recursive
Indeed, thanks.

I will update the code in the repo asap with a register method for the example.

On 28 Sep 2011, at 20:45, [hidden email] wrote:

> You need to add the relevant JS libraries in the seaside configuration of the example application for it to work:
>
> JQUIDevelopmentLibrary
> JQDevelopmentLibrary
>
>
> _______________________________________________
> 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