I am following 'Dynamic Web Development with Seaside, I don't quite understand

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I am following 'Dynamic Web Development with Seaside, I don't quite understand

Intrader Intrader
how Cancel can work with embedded subcomponents. The example I am follogin is in chapter 12.2.
The way the example is coded in the example it suggests that pressing cancel does not cancel the changes made to the list of contacts. The text recommends that I refer to the solution in chapter 11.5. The code I have come up with is:
<code>
editContact: aContact
	| copy |
	copy := aContact copy.
	(editor contact: aContact) onAnswer: [ :answer |
		answer ifFalse: [
			"aContact has changed contact regardless of whether 
editor answers true or false;
			 copy has the original"
			MyContact removeContact: aContact.
			MyContact addContact: copy.
			"the editor view still has changed value; the view 
should be rerendered with original value (the copy)".
			] 
</code>

1. A  second click on the Cancel button results in "Error: Object is not in the collection."; the code is  attempting to delete aContact a second time. The copy is indeed added to the collection but it does not replace the collection entry corresponding to where aContact was obtained.

2. Further the editor subcomponent does not revert to its original state. Should the button be a reset button instead of a cancel button

3. The list component is not updated when the contact name is changed.

It appears that the callback containing the editor reference should be updated.

A possible solution would be to deep copy the copy reference back into the aContact reference (not remove the aContact entry). Is there a collection method for doing this?

Thanks.

P.S. I have submitted this to gmane.comp.lang.smalltalk.squeak.seaside




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc