Discussion:
[Dojo-interest] dojo/domReady! vs dijit.byId vs registry.byId
medesi73
2014-11-08 16:36:52 UTC
Permalink
<html>
<head>
require([dijit.form.RadioButton, dojo/domReady!],
function(RadioButton) {

console.log("Radio Button :", dijit.byId("selection);
console.log("Radio Button :", registry.byId("selection);

}
</head>
<body>
<input id="selection" type="radio"
dojo-Type="dijit.form.RadioButton"/>
</body>

</html>

In above pseudo code both console.log functions are giving undefined. As i
am giving domRady! id specified in require the function will wait until the
dom is loaded (i.e the content in body tag) , as the dom is already loaded
why the console.log are giving undefined ? Is my understanding is worng ?
how to get the selection widger reference ?

Thanks,
Durga



--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojo-domReady-vs-dijit-byId-vs-registry-byId-tp4004238.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Dylan Schiemann
2014-11-08 17:20:02 UTC
Permalink
It's difficult to tell what was a typo vs. omission with your example.
You had several things that are mixing old pre-AMD and newer AMD based
concepts. Here's a cleaned up example:

<html>
<head>
<!-- add css here -->
</head>
<body class="claro">
<input id="selection" type="radio"
data-dojo-type="dijit/form/RadioButton">
<script src="path/to/dojo.js" data-dojo-config="async:1, isDebug:
1"></script>
<script>
require([
'dojo/parser',
'dijit/registry',
'dijit/form/RadioButton',
'dojo/domReady!'
], function (parser, registry) {
parser.parse();
console.log('Radio Button :', registry.byId('selection');
});
</script>
</body>
</html>

I highly recommend reading
http://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/

Regards,
-Dylan
Post by medesi73
<html>
<head>
require([dijit.form.RadioButton, dojo/domReady!],
function(RadioButton) {
console.log("Radio Button :", dijit.byId("selection);
console.log("Radio Button :", registry.byId("selection);
}
</head>
<body>
<input id="selection" type="radio"
dojo-Type="dijit.form.RadioButton"/>
</body>
</html>
In above pseudo code both console.log functions are giving undefined. As i
am giving domRady! id specified in require the function will wait until the
dom is loaded (i.e the content in body tag) , as the dom is already loaded
why the console.log are giving undefined ? Is my understanding is worng ?
how to get the selection widger reference ?
Thanks,
Durga
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojo-domReady-vs-dijit-byId-vs-registry-byId-tp4004238.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dylan Schiemann
SitePen, Inc.
Dojo workshops in the US, Canada, and Europe:
http://www.sitepen.com/workshops/
SitePen Insider: http://sitepen.com/insider/
http://www.sitepen.com/
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
medesi73
2014-11-08 22:08:00 UTC
Permalink
Sorry it is typo only i am using newer AMD approach only, one thing that is
missing in my code is parser.parse(); does it required/compulsory to use
that statement ?
I have an application with master detail approach when user selects the link
corresponding page will be displayed in the contentpane does each page is
designed as newer AMD in this case does each page should have parser.parse()
function call ?

Thanks,
Durga



--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojo-domReady-vs-dijit-byId-vs-registry-byId-tp4004238p4004242.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Dylan Schiemann
2014-11-09 04:54:33 UTC
Permalink
If you define your widgets to be instantiated from markup, then yes, you
need to parse the markup to convert them from plain DOM nodes to widgets.

Otherwise, you can instantiate your widgets programmatically via
JavaScript constructors. See the early parts of
http://dojotoolkit.org/documentation/tutorials/1.10/declarative/ for an
explanation.

Regards,
-Dylan
Post by medesi73
Sorry it is typo only i am using newer AMD approach only, one thing that is
missing in my code is parser.parse(); does it required/compulsory to use
that statement ?
I have an application with master detail approach when user selects the link
corresponding page will be displayed in the contentpane does each page is
designed as newer AMD in this case does each page should have parser.parse()
function call ?
Thanks,
Durga
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojo-domReady-vs-dijit-byId-vs-registry-byId-tp4004238p4004242.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dylan Schiemann
SitePen, Inc.
Dojo workshops in the US, Canada, and Europe:
http://www.sitepen.com/workshops/
SitePen Insider: http://sitepen.com/insider/
http://www.sitepen.com/
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-***@mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...