JQ accordion with Time now

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

JQ accordion with Time now

dtrussardi@tiscali.it
Hi,


        i use JQ accordion how in the the JQAccordionFunctionalTest :

> renderContentOn: html
> html div
> script: ( html jQuery new accordion
> animated: 'bounceslide';
> active: 1;
> collapsible: true ) ;
> with: [
> self berries keysAndValuesDo: [ :name :description |
> html div: [ html anchor: name ].
> html div: [
>
> html text: Time now asString
>
> html break.
>
> html paragraph: description ] ] ]


I add the html text: Time now asString

Now the accordion don't report the time  update  ad the  expand time   but at the JQ accordion  creation.

       
        How i can rendering the time update at the expand time ?


        Thanks,

                Dario


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

Re: JQ accordion with Time now

Paul DeBruicker
You either need to load the accordion contents using ajax or set a click
event on the anchor that uses javascript to put the current time in the
accordion body.  I haven't tested any of this but it should get you
started.



First option is set the accordion body to an empty div with an id e.g.:

        html div id:'accordion-body'

and change the link to load the accordion body with the current time
from the server when clicked:

        html anchor
                onClick:(html jQuery id:'accordion-body') load html:[:h | self
renderAccordionBody: h];
                with: name

and

        renderAccordionBody:html
                html text: Time now asString
                html break.
                html paragraph: description





The second option is to do it all on the client with javascript:

Change

        html text: Time now asString

to:
        html div id:'time'.

and change

        html anchor: name

to:

        html anchor
                onClick(JSStream on: '$("#time").empty().text(Date())';
                with: name


Getting a format for the time string is a job and here is a link to see
some options:
http://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript



On 05/12/2012 08:46 AM, [hidden email] wrote:

> Hi,
>
>
> i use JQ accordion how in the the JQAccordionFunctionalTest :
>
>> renderContentOn: html
>> html div
>> script: ( html jQuery new accordion
>> animated: 'bounceslide';
>> active: 1;
>> collapsible: true ) ;
>> with: [
>> self berries keysAndValuesDo: [ :name :description |
>> html div: [ html anchor: name ].
>> html div: [
>>
>> html text: Time now asString
>>
>> html break.
>>
>> html paragraph: description ] ] ]
>
>
> I add the html text: Time now asString
>
> Now the accordion don't report the time  update  ad the  expand time   but at the JQ accordion  creation.
>
>
> How i can rendering the time update at the expand time ?
>
>
> Thanks,
>
> Dario
>
>
> _______________________________________________
> 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: JQ accordion with Time now

dtrussardi@tiscali.it

Thank Paul,

First option is set the accordion body to an empty div with an id e.g.:

html div id:'accordion-body'

and change the link to load the accordion body with the current time from the server when clicked:

html anchor
onClick:(html jQuery id:'accordion-body') load html:[:h | self renderAccordionBody: h];
with: name

and

renderAccordionBody:html
html text: Time now asString
html break.
html paragraph: description



This is my case where i use   Time now asString   only as example for test  dynamic rendering of smalltalk data.


Your solution work, but  the rendering create a  ' flicker ' because when i click on the accordion header anchor ( several times )

the system first rendering the hold accordion body data and after rendering the update data generating by onClick: load


Ciao,

Dario


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