Ajax callback question: how to update component tree before #children gets called?

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

Re: Re: Re: Re: Re: Ajax callback question: howtoupdatecomponenttreebefore #children gets called?

Sophie424
"Lukas Renggli" <[hidden email]> wrote

>> Maybe changing the callback method name would help to understand.,
>> maybe having a keyword (#callback:inComponent:)
> That doesn't work, because a callback could render to many components.

I may be way off here, but why does it have to be all in a single callback?
Could we do this:
- Explicitly separate one ModelUpdate vs. many ViewUpdates
- Allow each ViewUpdate to be callback:inComponent:

e.g.

WATagBrush>>
    onClick: aModelUpdateString then: manyViewUpdatesStrings

SUUpdater>>
    callback: aViewUpdateBlock inComponent: aComponent

html anchor
  onClick:
    "do this first (wait for success event?)"
    (html request callback: [self updateModel])

  then:
    "then do this array of updates in parallel"
     {(html updater
         "id: anId not required; must be compA id"
         callback: [self viewUpdateA] inComponent: compA).
      (html updater
         "id: anId not required; must be compB id"
         callback: [self viewUpdateB] inComponent: compB).
      (html updater
         "by convention, on current component"
         callback: [self viewUpdate]). };

  with: 'do it'.

It would be nice if something like this could this be done without requiring
the user to deal with the underlying Ajax lifecycle events.

Even better abstracted, if this is a common pattern:
  onClick: aModelUpdateBlock then: someViewUpdateComponents+Blocks

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: Re: Re: Re: Ajax callback question:howtoupdatecomponenttreebefore #children gets called?

Sophie424
"itsme213" <[hidden email]> wrote in message
news:fol64u$vqb$[hidden email]...

> "Lukas Renggli" <[hidden email]> wrote
>
>>> Maybe changing the callback method name would help to understand.,
>>> maybe having a keyword (#callback:inComponent:)
>> That doesn't work, because a callback could render to many components.
>
> I may be way off here, but why does it have to be all in a single
> callback? Could we do this:
> - Explicitly separate one ModelUpdate vs. many ViewUpdates
> - Allow each ViewUpdate to be callback:inComponent:
>
> e.g.
>
> WATagBrush>>
>    onClick: aModelUpdateString then: manyViewUpdatesStrings
>
> SUUpdater>>
>    callback: aViewUpdateBlock inComponent: aComponent
>
> html anchor
>  onClick:
>    "do this first (wait for success event?)"
>    (html request callback: [self updateModel])
>
>  then:
>    "then do this array of updates in parallel"
>     {(html updater
>         "id: anId not required; must be compA id"
>         callback: [self viewUpdateA] inComponent: compA).
>      (html updater
>         "id: anId not required; must be compB id"
>         callback: [self viewUpdateB] inComponent: compB).
>      (html updater
>         "by convention, on current component"
>         callback: [self viewUpdate]). };
>
>  with: 'do it'.
>
> It would be nice if something like this could this be done without
> requiring the user to deal with the underlying Ajax lifecycle events.
>
> Even better abstracted, if this is a common pattern:
>  onClick: aModelUpdateBlock then: someViewUpdateComponents+Blocks
>
> 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: Re: Re: Re: Ajax callback question:howtoupdatecomponenttreebefore #children gets called?

Sophie424
In reply to this post by Sophie424
(sorry about the accidental empty post).

"itsme213" <[hidden email]> wrote

> html anchor
>  onClick:
>    "do this first (wait for success event?)"
>    (html request callback: [self updateModel])
>
>  then:
>    "then do this array of updates in parallel"
>     {(html updater
>         "id: anId not required; must be compA id"
>         callback: [self viewUpdateA] inComponent: compA).

>      (html updater
>         "id: anId not required; must be compB id"
>         callback: [self viewUpdateB] inComponent: compB).

Those callbacks would need a rendering canvas parameter.
        callback: [:renderer | self updateViewAOn: renderer]

Perhaps this can be combined with Holger Kleinsorgen's #asyncRenderWith
http://www.nabble.com/session-variable-vs.-dynamic-variable-td15349511.html#a15370912
so the same rendering code block of the appropriate component is
(a) run for the initial rendering, and
(b) automatically re-run for each subsequent ajax re-rendering.


- Sophie



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