[Seaside] Nested Editor Components - One More Time

Joel Turnbull joel at ardishealth.com
Mon May 25 22:37:19 UTC 2009


On Mon, May 25, 2009 at 11:54 AM, John McKeon <p3anoman at gmail.com> wrote:

> 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.


Thanks John.  Using Pharo Web Image 09.04.6, and the Seaside that came
packaged up with that ( not sure how to check the version ).

>
>
> 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


That's a good tip thanks.

The control is a meant to be little more sophisticated and can actually add
a new phone number between two phone numbers, it adds a new phone number
under whichever row you click "Add" on. I don't have it coded in, but if
there are no phone numbers yet, then the report would be simply be an "Add
Phone Number" link.

>
>
> 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.


I'm glad to hear that's what it should do, now it's just a matter of
figuring out what strange thing I did to make it NOT do that.

I cleaned up those class methods and there was a halt in there too that
shouldn't have been. Attaching the .mcz seemed to be giving me problems this
morning so I just put it here for download:
http://www.joelturnbull.com/JLLT-EditorsTest-JLL.2.mcz

It's just a test case with a method that creates a sample customer...doesn't
persist anything...it just demos the problem I'm having.

>
>
> 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
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090525/8649d3b6/attachment.htm


More information about the seaside mailing list