something like #callback:value: but for #html: ?

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

something like #callback:value: but for #html: ?

EstebanLM
Hi,
I'm trying to fill an JQAccordion when user opens it, and I think the way to do that is by doing something like this:

html div
        script: (
                html jQuery new accordion
                        active: self selectedIndex - 1;  
                        autoHeight: false;  
                        onChangestart: ((html jQuery new
                                        alias: 'ui';
                                        access: 'newContent';
                                        call: 'load' with: (html jQuery ajax
                                                html: [ :renderer | renderer text: 'TEST' ];
                                                fullUrl))
                                asFunction: #(event ui)));
        with: [
                html div id: 'header1'; with: 'header1'.
                html div.
                html div id: 'header2'; with: 'header2'.
                html div ]

this example is working fine, but I'm always rendering 'TEST'. I need to discriminate which content I need to render, so I need the header id value. Using #callback:value I would call something like:

        ((html jQuery ajax
                callback: [ :v | "Some code here" ]
                        value: (html jQuery new
                                alias: 'ui';
                                access: 'newHeader';
                                call: 'attr' with: 'id'))
                asFunction: #(event ui))

but I don't have nothing similar with #html: .

of course, I can call first a callback who sets the "current header", then make an ajax call, but that's not efficient (two calls instead one).
so, I would like to have something like #html:value:

does anybody knows how can I solve this problem?

thanks,
Esteban

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

RE: something like #callback:value: but for #html: ?

Robert Sirois
Use a component or use the renderer block like a normal canvasser.

The examples should load with seaside core.

RS

> From: estebanlm@gmail.com
> Date: Wed, 29 Jun 2011 23:55:58 -0300
> To: seaside@lists.squeakfoundation.org
> Subject: [Seaside] something like #callback:value: but for #html: ?
>
> Hi,
> I'm trying to fill an JQAccordion when user opens it, and I think the way to do that is by doing something like this:
>
> html div
> script: (
> html jQuery new accordion
> active: self selectedIndex - 1;
> autoHeight: false;
> onChangestart: ((html jQuery new
> alias: 'ui';
> access: 'newContent';
> call: 'load' with: (html jQuery ajax
> html: [ :renderer | renderer text: 'TEST' ];
> fullUrl))
> asFunction: #(event ui)));
> with: [
> html div id: 'header1'; with: 'header1'.
> html div.
> html div id: 'header2'; with: 'header2'.
> html div ]
>
> this example is working fine, but I'm always rendering 'TEST'. I need to discriminate which content I need to render, so I need the header id value. Using #callback:value I would call something like:
>
> ((html jQuery ajax
> callback: [ :v | "Some code here" ]
> value: (html jQuery new
> alias: 'ui';
> access: 'newHeader';
> call: 'attr' with: 'id'))
> asFunction: #(event ui))
>
> but I don't have nothing similar with #html: .
>
> of course, I can call first a callback who sets the "current header", then make an ajax call, but that's not efficient (two calls instead one).
> so, I would like to have something like #html:value:
>
> does anybody knows how can I solve this problem?
>
> thanks,
> Esteban
>
> _______________________________________________
> 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: something like #callback:value: but for #html: ?

Paul DeBruicker
In reply to this post by EstebanLM
On 06/29/2011 10:55 PM, Esteban Lorenzano wrote:

> Hi,
> I'm trying to fill an JQAccordion when user opens it, and I think the way to do that is by doing something like this:
>
> html div
> script: (
> html jQuery new accordion
> active: self selectedIndex - 1;
> autoHeight: false;
> onChangestart: ((html jQuery new
> alias: 'ui';
> access: 'newContent';
> call: 'load' with: (html jQuery ajax
> html: [ :renderer | renderer text: 'TEST' ];
> fullUrl))
> asFunction: #(event ui)));
> with: [
> html div id: 'header1'; with: 'header1'.
> html div.
> html div id: 'header2'; with: 'header2'.
> html div ]
>
> this example is working fine, but I'm always rendering 'TEST'. I need to discriminate which content I need to render, so I need the header id value. Using #callback:value I would call something like:
>
> ((html jQuery ajax
> callback: [ :v | "Some code here" ]
> value: (html jQuery new
> alias: 'ui';
> access: 'newHeader';
> call: 'attr' with: 'id'))
> asFunction: #(event ui))
>
> but I don't have nothing similar with #html: .
>
> of course, I can call first a callback who sets the "current header", then make an ajax call, but that's not efficient (two calls instead one).
> so, I would like to have something like #html:value:
>
> does anybody knows how can I solve this problem?
>
> thanks,
> Esteban
>

You can use an anchor for the 'header' rather than a div and have its
onClick event get content for the sibling div.  You wouldn't need the
onChangestart: call.

The demo on the jQuery UI Accordion demo page uses anchors as the headers.

Something like this should work:


html div
  script: (
                html jQuery new accordion
  active: self selectedIndex - 1;
  autoHeight: false;
  with: [
  html anchor onClick ((html jQuery id: 'div1')) load html:[:h | self
renderDiv1ContentOn: h]; with: 'header1'.
  html div id: 'div1'.
  html anchor onClick ((html jQuery id: 'div2')) load html:[:h | self
renderDiv2ContentOn: h]; with: 'header2'.
  html div id: 'div2'. ]
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside