Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in declaration string to support working in Dojo templated widgets #79

Closed
martinpengellyphillips opened this issue Feb 7, 2012 · 5 comments

Comments

@martinpengellyphillips
Copy link

Seems that in the declarations of the classes adding "dgrid.Class" enables them to work with templated widgets in Dojo. Otherwise a missing class error is given by the dojo parser.

Example:

List.js

return declare(TouchScroll ? [TouchScroll] : [], {
return declare("dgrid.List", TouchScroll ? [TouchScroll] : [], {
@ghost
Copy link

ghost commented Feb 7, 2012

This is specifically not done because it would expose an additional global. Given that best practices with AMD discourage creating unnecessary globals, this is not something we really want to add to dgrid. As you say, however, it does present a challenge with the current Dojo parser.

Currently, the way to get around this is to expose any constructors you need parser to have access to yourself - which generally won't be the List module, but more likely the GridFromHtml module, or some constructor created using declare which mixes in GridFromHtml and any number of mixins/extensions. You can see examples of this done in some of the test pages, for example test/GridFromHtml.html (currently lines 91-92).

Note that currently there is also discussion going around for Dojo 1.8 to add support for parser to pick up data-dojo-type values which reference module identifiers (e.g. dgrid/GridFromHtml), which will make this less of a pain point.

Thanks for bringing this up though, I realize now that despite my memory suggesting otherwise, the README doesn't seem to make any mention of playing nicely with the parser. I'll see about adding a paragraph about that.

@neonstalwart
Copy link
Contributor

fyi - the module identifier patch is in current trunk http://bugs.dojotoolkit.org/ticket/13778 for reference

@martinpengellyphillips
Copy link
Author

Thanks for the quick response, makes sense as well in the grand scheme.

@kitsonk
Copy link

kitsonk commented Feb 7, 2012

Yup, the only thing really under debate for 1.8 is whether the modules will have to be explicitly required before the parser is invoked. That means significant changes to the dojo/parser that maybe a step too far before 2.0.

@ghost
Copy link

ghost commented Feb 7, 2012

Just added a note about using parser + dgrid in 1.7, in f6b4522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants