Problem Inspecting Magritte components

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

Problem Inspecting Magritte components

Brian Brown-2
I'm doing the following:

renderContentOn: html
        html render: ((self parent person asComponent)
                readonly: true;
                yourself ).
        html form with: [html submitButton callback: [self editClient];  
value: 'edit']


To view a model object... everything seems to work fine. When I  
toggle halos and try to see source or inspect one of the Magritte  
components, it fails, because they aren't being returned by #children  
anywhere. Is there a way I can cache the component, or do this a  
different way?

Thanks,

Brian


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

RE: Problem Inspecting Magritte components

Ramon Leon-5
>
> I'm doing the following:
>
> renderContentOn: html
> html render: ((self parent person asComponent)
> readonly: true;
> yourself ).
> html form with: [html submitButton callback: [self editClient];
> value: 'edit']
>
>
> To view a model object... everything seems to work fine. When
> I toggle halos and try to see source or inspect one of the
> Magritte components, it fails, because they aren't being
> returned by #children anywhere. Is there a way I can cache
> the component, or do this a different way?
>
> Thanks,
>
> Brian

Common mistake, you don't use asComponent on the fly like that.  You need to
stick the result of asComponent into an instance variable, return it from
children, and then use html render: on the instance variable.  Seaside
components are stateful, instance variables stick around between page
requests.

Ramon Leon
http://onsmalltalk.com


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Problem Inspecting Magritte components

Brian Brown-2

On Jul 19, 2007, at 6:08 PM, Ramon Leon wrote:

>>
>> I'm doing the following:
>>
>> renderContentOn: html
>> html render: ((self parent person asComponent)
>> readonly: true;
>> yourself ).
>> html form with: [html submitButton callback: [self editClient];
>> value: 'edit']
>>
>>
>> To view a model object... everything seems to work fine. When
>> I toggle halos and try to see source or inspect one of the
>> Magritte components, it fails, because they aren't being
>> returned by #children anywhere. Is there a way I can cache
>> the component, or do this a different way?
>>
>> Thanks,
>>
>> Brian
>
> Common mistake, you don't use asComponent on the fly like that.  
> You need to
> stick the result of asComponent into an instance variable, return  
> it from
> children, and then use html render: on the instance variable.  Seaside
> components are stateful, instance variables stick around between page
> requests.
>

Well, sure - I've known this for years, but with all the Magritte  
examples I've seen in the image, caching wasn't being used, mostly  
just #call: and #answer:, so I guess I became confused :)

thanks,

Brian



> Ramon Leon
> http://onsmalltalk.com
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki