[Seaside] Re: Update a component after a Jquery

Paul DeBruicker pdebruic at gmail.com
Sun May 31 15:02:12 UTC 2015


Hi Hilaire,

I'm sure you can do what you want without a full page refresh.  Below is an
example.  You choose one of 5 divs to update and  the response and then
update two spots on the page at once.  


renderContentOn: html
	html select
		list: #('a' 'b' 'c' 'd' 'e');
		onChange:
				(html jQuery ajax
						serializeThis;
						onComplete:
								((html jQuery id: 'selected') load
										html: [ :h | 
											h render: 'Last picked ' , chosenDiv greaseString.
											h script: ((h jQuery id: chosenDiv) html: [ :r | r span:
DateAndTime now ]) ]));
		selected: chosenDiv;
		callback: [ :val | chosenDiv := val ].
	html span
		id: 'selected';
		with: 'Last picked ' , chosenDiv greaseString.
	#('a' 'b' 'c' 'd' 'e')
		do: [ :ea | 
			html div
				id: ea;
				with: 'not chosen yet' ]



You can use the #onSelect: of the datepicker to trigger the change like I've
used the #onChange: of the select above. 


Hope this helps.


Paul



HilaireFernandes wrote
> Le 29/05/2015 03:40, Paul DeBruicker a écrit :
>> mail client coding but something like this should work:
>>
>>
>> (html jQuery new datepicker onSelect: (html jQuery
>> ajax serializeThis;onSuccess:((html jQuery id: 'myTableContainerId') load
>> html: [:h | h render: myTable])).
>>
> 
> Thanks. I am not sure I can apply it.
> 
> The change in the model results in a new div element, containing a table
> populated with content. Moreover depending on the imputed date, the div
> element position may vary in the DOM tree. I think a whole refresh,
> server side, may be simpler.
> 
> Hilaire
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> http://google.com/+DrgeoEu
> 
> _______________________________________________
> seaside mailing list

> seaside at .squeakfoundation

> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside





--
View this message in context: http://forum.world.st/Update-a-component-after-a-Jquery-tp4829158p4829611.html
Sent from the Seaside General mailing list archive at Nabble.com.


More information about the seaside mailing list