Juan Burella a écrit :
Using this version it works in a different way but not
completely right. When the second list is selected everything works
fine, but then the first one is selected, it disappears leaving only
the second and the third visible.
I got some new ideas...
See Seaside2.5b8-mb.15
The nested live callbacks work for me with the attached example.
Can you also try with your code ?
Michel.
Something I did not mention in my previous posts: when you are nesting
live callbacks,
the Javascript must execute all the <script> tags produced by the live
callbacks.
This is also part of the new implementation.
'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 28 October
2005 at 6:11:36 pm'!
WAComponent subclass: #NestedLiveCallbackExample
instanceVariableNames: 'country province city'
classVariableNames: ''
poolDictionaries: ''
category: 'SeaComp-Example'!
!NestedLiveCallbackExample methodsFor: 'initialization' stamp: 'mb 10/28/2005
17:52'!
initialize
self country: 'Argentina'.! !
!NestedLiveCallbackExample methodsFor: 'rendering' stamp: 'mb 10/28/2005 17:48'!
renderCitiesOn: aRenderer
aRenderer spanNamed: 'citySelector' with:
[aRenderer
selectFromList: self cityNames
selected: city
callback:[:f | city := f ]
labels: [:ea | ea ]]
! !
!NestedLiveCallbackExample methodsFor: 'rendering' stamp: 'mb 10/28/2005 17:49'!
renderContentOn: aRenderer
aRenderer
selectFromList: #( 'Argentina' 'Aruba' )
selected: country
callback:[:f | self error: 'Should never come here' ]
labels: [:ea | ea ]
liveCallback:
[:anObject :h |
country := anObject.
province := self provinceNames first.
city := self cityNames first.
self renderProvincesOn: h].
self renderProvincesOn: aRenderer.
! !
!NestedLiveCallbackExample methodsFor: 'rendering' stamp: 'mb 10/28/2005 17:49'!
renderProvincesOn: aRenderer
aRenderer spanNamed: 'provinceSelector' with:
[aRenderer
selectFromList: self provinceNames
selected: province
callback:[:f | self error: 'Should never come here' ]
labels: [:ea | ea ]
liveCallback:
[:anObject :h |
province := anObject.
city := self cityNames first.
self renderCitiesOn: h]].
self renderCitiesOn: aRenderer.
! !
!NestedLiveCallbackExample methodsFor: 'accessing' stamp: 'mb 10/28/2005 17:51'!
city: anObject
city := anObject.
! !
!NestedLiveCallbackExample methodsFor: 'accessing' stamp: 'mb 10/28/2005 17:45'!
cityNames
province = 'Oranjestad'
ifTrue: [^#( 'Casibari' 'Bubali') ].
province = 'Santa Cruz'
ifTrue: [^#( 'Arikok' 'Yamonta') ].
province = 'Buenos Aires'
ifTrue: [^#('La Plata' 'Azul')].
province = 'Cordoba'
ifTrue: [^#('Alta Gracia' 'La Falda ')].
^#()
! !
!NestedLiveCallbackExample methodsFor: 'accessing' stamp: 'mb 10/28/2005 17:52'!
country: anObject
country := anObject.
self province: self provinceNames first.
! !
!NestedLiveCallbackExample methodsFor: 'accessing' stamp: 'mb 10/28/2005 17:51'!
province: anObject
province := anObject.
self city: self cityNames first.
! !
!NestedLiveCallbackExample methodsFor: 'accessing' stamp: 'mb 10/28/2005 17:42'!
provinceNames
country = 'Aruba'
ifTrue: [^#('Oranjestad' 'Santa Cruz')].
country = 'Argentina'
ifTrue: [^#( 'Buenos Aires' 'Cordoba')].
^#()
! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
NestedLiveCallbackExample class
instanceVariableNames: ''!
!NestedLiveCallbackExample class methodsFor: 'as yet unclassified' stamp: 'jmb
10/27/2005 11:34'!
canBeRoot
^true! !
_______________________________________________
Seaside mailing list
Seaside@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
|