[Seaside] Appending to list of model objects&updating(sub)component list with scriptaculous / Ajax

itsme213 itsme213 at hotmail.com
Fri Aug 4 01:24:05 UTC 2006


Could someone help me understand why the code below shows the ajax inline 
editors fine until I do an add operations, and then requires a page reload 
to resume working right? I've tried many things with no luck.

Many thanks!

SUComponent subclass: #House
 instanceVariableNames: 'rooms'
 classVariableNames: ''
 poolDictionaries: ''
 category: 'MAp-House'!

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:40'!
children

 ^ self rooms! !

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:18'!
initialize

 self rooms: OrderedCollection new.! !

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:37'!
renderContentOn: html

 html div: 'a house'.

 self renderRoomsOn: html.

 html anchor
  onClick: ( html ajax
   id: 'theRooms';
   callback: [ :renderer | self rooms add: (Room new). self renderRoomsOn:
renderer ] ) ;
  with: '++'.! !

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:32'!
renderRoomsOn: html

 html div
  id: 'theRooms';
  with: [ self rooms do: [:room | html render: room]. ].
! !

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'!
rooms
 "Answer the value of rooms"

 ^ rooms! !

!House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'!
rooms: anObject
 "Set the value of rooms"

 rooms _ anObject! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

House class
 instanceVariableNames: ''!

!House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:13'!
canBeRoot

 ^ true! !

!House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:15'!
initialize
 (self registerAsApplication: 'house')
  libraries add: SUScriptLibrary! !


SUComponent subclass: #Room
 instanceVariableNames: 'name'
 classVariableNames: ''
 poolDictionaries: ''
 category: 'MAp-House'!

!Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:13'!
initialize

 self name: 'a room'! !

!Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:12'!
name

 ^ name! !

!Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'!
name: anObject
 "Set the value of name"

 name _ anObject! !

!Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 13:09'!
renderContentOn: html

   html paragraph
      script: (html inPlaceEditor
         callback: [ :value :renderer | self name: value. renderer render:
value , ' yup' ];
         cancelText: '');
      with: self name , ' yup'.! !

House initialize!



More information about the Seaside mailing list