[Seaside] Nested Editor Components - One More Time

John McKeon p3anoman at gmail.com
Mon May 25 15:54:11 UTC 2009


Joel,
You probably should give some details as to which Smalltalk, which version
of Seaside etc. I could not get the mcz package to load so I am going by
what I can glean from viewing the changes in your package. There are a bunch
of rendering methods that got added to the class side somehow that I think
is the cause of the failure to load. Try removing them and repackaging your
code.

Usual usage for a report of items like the phone report is to put an Add
button somewhere other than on the row of the existing item (other wise how
would one be able to add the first phonenumber). The Add button should
"call" the phone editor: self call: PhoneEditor. The phone editor would
return a Phone object instead of true or false so the call then looks like
           p := self call: phoneEditor.
          p isNil ifFalse: [ phones add: p ].

And your phone editor should  answer: phone instead of true/false

The PhoneReport is a child of the Customer editor, so calling the
PhoneEditor in this manner should only replace the Phone report not the
Customer component. This way the Customer data does not "disappear". Why it
is not doing that I cannot tell since I cannot run the code.

Hope this helps
John



On Mon, May 25, 2009 at 8:26 AM, Joel Turnbull <joel at ardishealth.com> wrote:

>
> Sorry I seem to keep losing my message text in the email :P
>
> ---------------
>
> I've boiled my question down to this...
>
> What's the best way to have an editor component retain the values of it's
> input fields, if those values have been changed, and nested components are
> calling editors of their own?
>
> An example scenario:
>
> I have a customer editor component that has a name input, and a nested
> phone number report component. Each report row has a phone number, type, and
> "Add" link. When it is clicked the report component calls and is replaced by
> a phone number editor component. This is happening within the customer
> editor.
>
> The problem is that when the phone number editor component is called, the
> value of the name input field in the customer editor reverts to it's
> original value if it had been changed. If it had a value of "Lenny" when the
> form renders, and the user changes the name to "Carl". It changes back to
> "Lenny" when the user goes to add a phone number.
>
> I get that when the anchor is clicked the form refreshes. So is ajax the
> answer? Or can I take a different approach with components?
>
> I have an .mcz of my test case that I tried to attach but I think it was
> messing up my post.
>
> Thanks
> Joel
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


-- 
http://jmck.seasidehosting.st
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090525/79b5b505/attachment-0001.htm


More information about the seaside mailing list