Dumb Question: How to render new state after ajax callbacks?

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

Dumb Question: How to render new state after ajax callbacks?

Richard Durr-2
Hello :)

For simplification, let's say I have two Components, Component1 and Component2, with the following methods:

Component1>>renderContentOn: html
html heading: 'Component1'.
html anchor
callback: [self call: Component2 new];
with: 'Call Component 2'

Component2>>renderContentOn: html
html heading: 'Component2'.
html anchor
callback: [self answer.];
with: 'Answer'.
html anchor
url: '#';
onClick: (html jQuery ajax callback: [self answer.]);
with: 'Answer using AJAX'

When I click on the Answer using AJAX link Component2 answers but oviously the page stays the same, even when I reload and does not reflect the new state of the application where Component2 has answered. How can I re-synchronize server side and client side after this situation occured such that the page reflects the new state, where Component2 has answered? 

RD

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

Re: Dumb Question: How to render new state after ajax callbacks?

Lukas Renggli
You cannot use #call: and #answer: from within AJAX callbacks.

Have a look at the recent posts with the subject "Subclass MAReport
(in Magritte) to get clickable (selectable) rows"

Cheers,
Lukas

2009/10/15 Richard Durr <[hidden email]>:

> Hello :)
> For simplification, let's say I have two Components, Component1 and
> Component2, with the following methods:
> Component1>>renderContentOn: html
> html heading: 'Component1'.
> html anchor
> callback: [self call: Component2 new];
> with: 'Call Component 2'
> Component2>>renderContentOn: html
> html heading: 'Component2'.
> html anchor
> callback: [self answer.];
> with: 'Answer'.
> html anchor
> url: '#';
> onClick: (html jQuery ajax callback: [self answer.]);
> with: 'Answer using AJAX'
> When I click on the Answer using AJAX link Component2 answers but oviously
> the page stays the same, even when I reload and does not reflect the new
> state of the application where Component2 has answered. How can I
> re-synchronize server side and client side after this situation occured such
> that the page reflects the new state, where Component2 has answered?
> RD
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
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: Dumb Question: How to render new state after ajax callbacks?

Karsten Kusche
In reply to this post by Richard Durr-2
Hi Richard,

you can't do that with Ajax easily. The problem is that during an AJAX callback you're actually rendering and not in the normal callback phase.
You could however register a callback that does the answer and send Javascript back to the browser to make the browser jump to the callback's url. However, that's a bit tricky :-)

Kind Regards
Karsten



Am 15.10.09 14:23, schrieb Richard Durr:
Hello :)

For simplification, let's say I have two Components, Component1 and Component2, with the following methods:

Component1>>renderContentOn: html
html heading: 'Component1'.
html anchor
callback: [self call: Component2 new];
with: 'Call Component 2'

Component2>>renderContentOn: html
html heading: 'Component2'.
html anchor
callback: [self answer.];
with: 'Answer'.
html anchor
url: '#';
onClick: (html jQuery ajax callback: [self answer.]);
with: 'Answer using AJAX'

When I click on the Answer using AJAX link Component2 answers but oviously the page stays the same, even when I reload and does not reflect the new state of the application where Component2 has answered. How can I re-synchronize server side and client side after this situation occured such that the page reflects the new state, where Component2 has answered? 

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

-- 
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

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

Re: Dumb Question: How to render new state after ajax callbacks?

Julian Fitzell-2
Is there an advantage to that approach over just using a normal callback?

Julian

On Thu, Oct 15, 2009 at 5:32 AM, Karsten <[hidden email]> wrote:

> Hi Richard,
>
> you can't do that with Ajax easily. The problem is that during an AJAX
> callback you're actually rendering and not in the normal callback phase.
> You could however register a callback that does the answer and send
> Javascript back to the browser to make the browser jump to the callback's
> url. However, that's a bit tricky :-)
>
> Kind Regards
> Karsten
>
>
>
> Am 15.10.09 14:23, schrieb Richard Durr:
>
> Hello :)
> For simplification, let's say I have two Components, Component1 and
> Component2, with the following methods:
> Component1>>renderContentOn: html
> html heading: 'Component1'.
> html anchor
> callback: [self call: Component2 new];
> with: 'Call Component 2'
> Component2>>renderContentOn: html
> html heading: 'Component2'.
> html anchor
> callback: [self answer.];
> with: 'Answer'.
> html anchor
> url: '#';
> onClick: (html jQuery ajax callback: [self answer.]);
> with: 'Answer using AJAX'
> When I click on the Answer using AJAX link Component2 answers but oviously
> the page stays the same, even when I reload and does not reflect the new
> state of the application where Component2 has answered. How can I
> re-synchronize server side and client side after this situation occured such
> that the page reflects the new state, where Component2 has answered?
> RD
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> --
> Karsten Kusche - Dipl. Inf. - [hidden email]
> Georg Heeg eK - Köthen
> Handelsregister: Amtsgericht Dortmund A 12812
>
> _______________________________________________
> 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: Dumb Question: How to render new state after ajax callbacks?

Richard Durr-2
Many Thanks for the answers, I take a look. (I would prefer an ajax-answer in my current application because that wouldn't introduce the necessarity to handle a special case.)

On Thu, Oct 15, 2009 at 6:52 PM, Julian Fitzell <[hidden email]> wrote:
Is there an advantage to that approach over just using a normal callback?

Julian

On Thu, Oct 15, 2009 at 5:32 AM, Karsten <[hidden email]> wrote:
> Hi Richard,
>
> you can't do that with Ajax easily. The problem is that during an AJAX
> callback you're actually rendering and not in the normal callback phase.
> You could however register a callback that does the answer and send
> Javascript back to the browser to make the browser jump to the callback's
> url. However, that's a bit tricky :-)
>
> Kind Regards
> Karsten
>
>
>
> Am 15.10.09 14:23, schrieb Richard Durr:
>
> Hello :)
> For simplification, let's say I have two Components, Component1 and
> Component2, with the following methods:
> Component1>>renderContentOn: html
> html heading: 'Component1'.
> html anchor
> callback: [self call: Component2 new];
> with: 'Call Component 2'
> Component2>>renderContentOn: html
> html heading: 'Component2'.
> html anchor
> callback: [self answer.];
> with: 'Answer'.
> html anchor
> url: '#';
> onClick: (html jQuery ajax callback: [self answer.]);
> with: 'Answer using AJAX'
> When I click on the Answer using AJAX link Component2 answers but oviously
> the page stays the same, even when I reload and does not reflect the new
> state of the application where Component2 has answered. How can I
> re-synchronize server side and client side after this situation occured such
> that the page reflects the new state, where Component2 has answered?
> RD
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> --
> Karsten Kusche - Dipl. Inf. - [hidden email]
> Georg Heeg eK - Köthen
> Handelsregister: Amtsgericht Dortmund A 12812
>
> _______________________________________________
> 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: Dumb Question: How to render new state after ajax callbacks?

Karsten Kusche
In reply to this post by Julian Fitzell-2
yeah, the advantage is that you can decide in Smalltalk, during an Ajax
callback, if you want to do a call: or not.
We did that in seaBreeze, because if you have a form and submit it using
ajax you might want to do some validation and based on this validation
you might want to either update some parts of your webpage, showing
errors, or you want to continue with your form.

Karsten




Am 15.10.09 18:52, schrieb Julian Fitzell:

> Is there an advantage to that approach over just using a normal callback?
>
> Julian
>
> On Thu, Oct 15, 2009 at 5:32 AM, Karsten<[hidden email]>  wrote:
>    
>> Hi Richard,
>>
>> you can't do that with Ajax easily. The problem is that during an AJAX
>> callback you're actually rendering and not in the normal callback phase.
>> You could however register a callback that does the answer and send
>> Javascript back to the browser to make the browser jump to the callback's
>> url. However, that's a bit tricky :-)
>>
>> Kind Regards
>> Karsten
>>
>>
>>
>> Am 15.10.09 14:23, schrieb Richard Durr:
>>
>> Hello :)
>> For simplification, let's say I have two Components, Component1 and
>> Component2, with the following methods:
>> Component1>>renderContentOn: html
>> html heading: 'Component1'.
>> html anchor
>> callback: [self call: Component2 new];
>> with: 'Call Component 2'
>> Component2>>renderContentOn: html
>> html heading: 'Component2'.
>> html anchor
>> callback: [self answer.];
>> with: 'Answer'.
>> html anchor
>> url: '#';
>> onClick: (html jQuery ajax callback: [self answer.]);
>> with: 'Answer using AJAX'
>> When I click on the Answer using AJAX link Component2 answers but oviously
>> the page stays the same, even when I reload and does not reflect the new
>> state of the application where Component2 has answered. How can I
>> re-synchronize server side and client side after this situation occured such
>> that the page reflects the new state, where Component2 has answered?
>> RD
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> --
>> Karsten Kusche - Dipl. Inf. - [hidden email]
>> Georg Heeg eK - Köthen
>> Handelsregister: Amtsgericht Dortmund A 12812
>>
>> _______________________________________________
>> 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
>
>
>    

--
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

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

Re: Dumb Question: How to render new state after ajax callbacks?

Julian Fitzell-2
Ah yes, of course. Good point.

Julian

On Thu, Oct 15, 2009 at 11:17 PM, Karsten <[hidden email]> wrote:

> yeah, the advantage is that you can decide in Smalltalk, during an Ajax
> callback, if you want to do a call: or not.
> We did that in seaBreeze, because if you have a form and submit it using
> ajax you might want to do some validation and based on this validation you
> might want to either update some parts of your webpage, showing errors, or
> you want to continue with your form.
>
> Karsten
>
>
>
>
> Am 15.10.09 18:52, schrieb Julian Fitzell:
>>
>> Is there an advantage to that approach over just using a normal callback?
>>
>> Julian
>>
>> On Thu, Oct 15, 2009 at 5:32 AM, Karsten<[hidden email]>  wrote:
>>
>>>
>>> Hi Richard,
>>>
>>> you can't do that with Ajax easily. The problem is that during an AJAX
>>> callback you're actually rendering and not in the normal callback phase.
>>> You could however register a callback that does the answer and send
>>> Javascript back to the browser to make the browser jump to the callback's
>>> url. However, that's a bit tricky :-)
>>>
>>> Kind Regards
>>> Karsten
>>>
>>>
>>>
>>> Am 15.10.09 14:23, schrieb Richard Durr:
>>>
>>> Hello :)
>>> For simplification, let's say I have two Components, Component1 and
>>> Component2, with the following methods:
>>> Component1>>renderContentOn: html
>>> html heading: 'Component1'.
>>> html anchor
>>> callback: [self call: Component2 new];
>>> with: 'Call Component 2'
>>> Component2>>renderContentOn: html
>>> html heading: 'Component2'.
>>> html anchor
>>> callback: [self answer.];
>>> with: 'Answer'.
>>> html anchor
>>> url: '#';
>>> onClick: (html jQuery ajax callback: [self answer.]);
>>> with: 'Answer using AJAX'
>>> When I click on the Answer using AJAX link Component2 answers but
>>> oviously
>>> the page stays the same, even when I reload and does not reflect the new
>>> state of the application where Component2 has answered. How can I
>>> re-synchronize server side and client side after this situation occured
>>> such
>>> that the page reflects the new state, where Component2 has answered?
>>> RD
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>>
>>> --
>>> Karsten Kusche - Dipl. Inf. - [hidden email]
>>> Georg Heeg eK - Köthen
>>> Handelsregister: Amtsgericht Dortmund A 12812
>>>
>>> _______________________________________________
>>> 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
>>
>>
>>
>
> --
> Karsten Kusche - Dipl. Inf. - [hidden email]
> Georg Heeg eK - Köthen
> Handelsregister: Amtsgericht Dortmund A 12812
>
> _______________________________________________
> 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: Dumb Question: How to render new state after ajax callbacks?

Denis Kudriashov
In reply to this post by Karsten Kusche

2009/10/15 Karsten <[hidden email]>
Hi Richard,

you can't do that with Ajax easily. The problem is that during an AJAX callback you're actually rendering and not in the normal callback phase.
You could however register a callback that does the answer and send Javascript back to the browser to make the browser jump to the callback's url. However, that's a bit tricky :-)
 
Hi.

Why It can not be implemented in simplest, user transparent way as Richard wrote? Or it can?
I think it's really usefull stuff.

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