Dojo not seem to parse widget declaratively created in a template html file of a custom widget.
But it works when I am declaratively create it in the home page where dojo configuration was done
here is the code snippet:
Home page:
<html>
<head>
<script type="text/javascript">
var dojoConfig = {
parseOnLoad: true,
isDebug: true,
modulePaths : {"com.cgb":"../../../client/vtm/com/cgb"}
};
</script>
<script type="text/javascript" src="../common/dojo/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("com.cgb.modules.deposit.step1_agreement");
dojo.require("dojox.mobile.ScrollableView");
</script>
</head>
<body>
<div data-dojo-type="com.cgb.modules.deposit.step1_agreement"></div>
</body>
</html>
the custom widget:
dojo.provide("com.cgb.modules.deposit.step1_agreement");
dojo.require("dojo.cache");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dojox.mobile.ScrollableView");
dojo.declare("com.cgb.modules.deposit.step1_agreement", [dijit._Widget, dijit._Templated], {
templateString: dojo.cache("com.cgb.modules.deposit", "templates/step1_agreement.html"),
postCreate:function(){
console.log("widget get instantiated");
}
});
template html of the custom widget:
<div>
<!--this widget didn't get parsed -->
<div id="view1" dojoType="dojox.mobile.ScrollableView" height="50px">
blah blahblah blah<br/>blah blahblah blah<br/>blah blahblah blah<br/>
blah blahblah blah<br/>blah blahblah blah<br/>blah blahblah blah<br/>
blah blahblah blah<br/>blah blahblah blah<br/>blah blahblah blah<br/>
</div>
</div>
the ScrollableView widget didn’t get parsed, but when I declare it at the Home page it works. I think maybe I must miss something, please help me out.
Since youre using dojox.mobile, youre probably in-between syntaxes with your code..
http://dojotoolkit.org/documentation/tutorials/1.7/modules/#Defining_modules
For future versions, where u use widgets in the template, the parameter
widgetsInTemplate: truegets deprecated. In turn, include thedijit._WidgetsInTemplateMixinas a mixin of your module.e.g; < 1.7
and 1.7+ ( expects module to have filename/path as module and namespace )