calling components inside an updated ajax div

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

calling components inside an updated ajax div

christian ponti-2
Hello list,
I have an application with a login system (basically from the tutorial) where the logged in user can configure some "stuff".
The view is divided in four blocks, an administration box on the left, a centered working box, a modules box on the right and another bottom box.
I have the same problem in two situation: from the administration box an anchor which calls a component with user configuration purposes and updates the central box where the component is rendered.

(html anchor)
                        onClick:
                                ((html updater)
                                        id: 'central';
                                        callback: [:renderer | self renderUserDataOn: renderer]);
                        with: 'Change User Data'.

i can modify the user data and submit change without problem but after clicking the submit button the component disappear, this without the classical self answer.

In the same way, at least in my opinion, on the right I can drag an image (representing my module) to the bottom box, where on dropping the code updates two divs, the bottom box itself where the dropped image is shown, and the central box where I want to be able to start the module configuration, calling some components.
The updating code is:

^(html evaluator)
        triggerPassenger:
                [:value |
                    self addModule: value.
                    self moduleConfiguratorComponent setModule: value];
        callback:
                [:script |
                    (script element)
                        id: id;
                        render: [:renderer | self renderModuleOn: renderer].
                    (script element)
                        id: 'central';
                        render: [:renderer | self renderModuleConfiguratorOn: renderer]]

the central box is diplayed but at this point when I click a submit button, which calls another component, as mentioned before the component disappears, but the called componed is not displyed.

In both cases calling the components directly ends with a correct behaviour.

Any idea why this happens?

Christian

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

Re: calling components inside an updated ajax div

cedreek
not sure but it might be that you need to put evalScripts: true. at
leat for the first example in the updater and if you use some js in
#renderUserDataOn:

SUUpdater>>evalScripts: aBoolean
"This determines whether <script> elements in the response text are
evaluated or not. The default implementation of Prototypes does not
evaluate script, however this implementation changes this odd
behavior."

hth,

Cédrick

2008/11/27 christian ponti <[hidden email]>:

> Hello list,
> I have an application with a login system (basically from the tutorial)
> where the logged in user can configure some "stuff".
> The view is divided in four blocks, an administration box on the left, a
> centered working box, a modules box on the right and another bottom box.
> I have the same problem in two situation: from the administration box an
> anchor which calls a component with user configuration purposes and updates
> the central box where the component is rendered.
>
> (html anchor)
>                         onClick:
>                                 ((html updater)
>                                         id: 'central';
>                                         callback: [:renderer | self
> renderUserDataOn: renderer]);
>                         with: 'Change User Data'.
>
> i can modify the user data and submit change without problem but after
> clicking the submit button the component disappear, this without the
> classical self answer.
>
> In the same way, at least in my opinion, on the right I can drag an image
> (representing my module) to the bottom box, where on dropping the code
> updates two divs, the bottom box itself where the dropped image is shown,
> and the central box where I want to be able to start the module
> configuration, calling some components.
> The updating code is:
>
> ^(html evaluator)
>         triggerPassenger:
>                 [:value |
>                     self addModule: value.
>                     self moduleConfiguratorComponent setModule: value];
>         callback:
>                 [:script |
>                     (script element)
>                         id: id;
>                         render: [:renderer | self renderModuleOn: renderer].
>                     (script element)
>                         id: 'central';
>                         render: [:renderer | self
> renderModuleConfiguratorOn: renderer]]
>
> the central box is diplayed but at this point when I click a submit button,
> which calls another component, as mentioned before the component disappears,
> but the called componed is not displyed.
>
> In both cases calling the components directly ends with a correct behaviour.
>
> Any idea why this happens?
>
> Christian
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


--
Cédrick

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

Re: calling components inside an updated ajax div

christian ponti-2
hi Cedrick,

thanks for the answer

not sure but it might be that you need to put evalScripts: true. at
leat for the first example in the updater and if you use some js in
#renderUserDataOn:

i think it is not a js problem (as i can understand, but in any case i added the method with no result) , actually #renderUserDataOn: renders only a component, which is initialized  in #children. That component contains a form that on submission write on a database and do nothing else; the final step would be to call #answer and make the component disappear. At this moment the component disappears but without calling #answer.

The second example uses js to update ( with an evaluator) a div inside the central box of the same component. After that the new component is rendered correctly; this is a very simple component which contains a brief explanation for the user and a button with a #call: on a configuration component, the one responsible for the real configuration. There is no js in there and the code inside the configuration component is executed but not rendered. In other words i cannot give control to him and return when i'm finished.

I don't know if it is very clear ... let me know :)

Christian


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