[Dojo-interest] On the fly declarative mixins?

Dustin Machi dmachi at dojotoolkit.org
Thu Apr 30 15:41:00 EDT 2009


I'm not sure I'd personally want to put the parser through all that  
myself.  Personally, if I don't follow the 'standard' path, then I do  
the mixin operation myself within the widget (based on one of the  
params) or I create my widget such that it will automatically pull in  
a set of mixins if they are available.  The other alternative is to  
create a widget that basically does this functionality as the widget  
is instantiated.   Note though that it seems like you are wanting to  
mixin to the instance, where the normal widget mixins are getting  
applied to the prototype.

Dustin

On Apr 30, 2009, at 3:22 PM, Michael Schuerig wrote:

> On Thursday 30 April 2009, Dustin Machi wrote:
>> maybe
>> http://www.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dij
>> it-and-dojo/writing-your-own-widget-class/dijit-declaratio ?
>
> Then I'd have to do the same thing in markup that I'd otherwise do in
> code, wouldn't I? The point of my question is that I want less  
> clutter,
> I don't just want to move it somewhere else. However, in principle
> dijit.Declaration is already pretty close, if I could only avoid  
> having
> to write it.
>
> Looking at the parser, it seems like getClassInfo could take an  
> array or
> comma-separated string instead of a plain class name, lookup or create
> an anonymous class and cache it for later. However, I'm not sure  
> whether
> this would break something else that might depend on the contents of  
> the
> dojoType attribute. I won't be able to try this out till after the
> weekend. What do you think?
>
> Michael
>
>> On Apr 30, 2009, at 8:53 AM, Michael Schuerig wrote:
>>> I have a mixin class for forms that adds a function for resetting
>>> contained dojox.form.BusyButtons. IIUC, to use this functionality,
>>> I have to define a new class like this
>>>
>>> dojo.declare("MyForm", [dijit.form.Form, my._Mixin], {});
>>>
>>> This is pretty boring code and it gets worse when there are more
>>> mixins
>>> to mix and match. Instead, I'd like to mix-in on the fly at the
>>> point of
>>> use
>>>
>>> <div dojoType="dijit.form.Form" mixin="my._Mixin" ...>
>>> ...
>>> </div>
>>>
>>> Is something similar already possible?
>
>
>
> -- 
> Michael Schuerig
> mailto:michael at schuerig.de
> http://www.schuerig.de/michael/
>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest



More information about the Dojo-interest mailing list