[Seaside] registerObjectForBacktracking, submit and execute block

radoslav hodnicak rh at 4096.sk
Sun Aug 29 12:16:42 CEST 2004


On Sun, 29 Aug 2004, Andreas Nilsson wrote:

> This is what i'm doing:
>
> records do: [
> 	html checkboxWithValue: (selection includes: aRecord) callback: [
> :isSelected |
> 		isSelected
> 			ifTrue: [ selection add: aRecord ]
> 			ifFalse: [ (selection includes: aRecord) ifTrue: [selection remove:
> aRecord] ].
> 	]
> ].
>
> html attributes at: 'onClick' put: 'javascript:submit()'.
> html anchorWithAction: [self removeRecords] text: 'Remove'.
>
> The checkboxes updates the selection on submit and the block removes
> the selected records.
> Both 'records' and 'selection' are registered for backtracking.
>  From your actual order it seems that everything is rendered and stored
> before removeRecords executes which would explain the problem.

Registering object for backtracking doesn't do what you probably
think it does. It's only sensitive to changes of objects, *not* object's
contents.

holder := WAStateHolder new.

holder contents: (OrderedCollection with: 1 with: 2).

holder contents add: 3. "NO CHANGES HERE, STILL THE SAME OBJECT IN HOLDER"

holder contents: (holder contents copyWith: 3). "NEW OBJECT IN HOLDER,
WILL BACKTRACK"

rado
-- 
gentleman, n. - a man who knows how to blog, but doesn't



More information about the Seaside mailing list