On Jan 9, 2007, at 1:13 PM, Diez B. Roggisch wrote:

>
>> Yep, that's exactly the reason.
>>
>>> However, a remedy _could_ be to make compound widgets aware of the
>>> needs of
>>> their children - this would be a one-time thing, at construction  
>>> time.
>>
>> Compound widgets are already aware of the needs of their children
>> (else the form wouldn't return the calendar's js ;)
>
> To a certain extent, they are.  But the JS we're talking about here is
> _rendered_ - as any other code of a child widget as well - directly  
> into the
> site.

Hmmm, I'm not sure we're talking in the same wavelength here... I  
guess you refer to the JS code that initializes some widgets (like  
the calendar) which is directly included in the calendar's template,  
right?

If this is the case, unfortunately, it's unavoidable in 1.0's  
implementation of widgets because you need to know the "real" DOM id  
of the textfield the calendar should place input to initialize it. In  
1.0 this id can *only* be known in the context of a request so that  
is why initialization takes place inside <script> tags in the  
calendar's template. This was much of a showstopper for me because it  
makes reusing existing widgets with JS enhancementes a real pain  
because you have to copy&paste the template and add the <script>  
tags, that's why it's fixed in ToscaWidgets ;). In TW you can know  
the real id inside a widget's constructor so JS-enhancing an existing  
widget is a matter of subclassing it and overriding __init__ to  
append a dynamically generated JSSource wth the JS initialization code.

> But if the compound-widget would return all JSLinks it's children  
> require as
> well as its own, that would be a different thing.

Hmmm, doesn't it do that already?? if this is a case then it's a bug.

Alberto


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to