[Seaside] JQ accordion with Time now

Paul DeBruicker pdebruic at gmail.com
Sat May 12 16:13:02 UTC 2012


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, dtrussardi at tiscali.it 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
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list