Hi guys, I'm trying to create some custom template widgets with dijit.layout objects (BorderContainer, ContentPane) in a template, and I just can't get it to work. Maybe SO can direct me in the right direction ... here is my code:
test.html
<html> <head> <title>Test Page</title> <style type="text/css"> @import "http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/resources/dojo.css"; @import "http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dijit/themes/tundra/tundra.css"; html, body, #page { width: 100%; height: 100%; overflow: hidden; } </style> <script type="text/javascript"> var djConfig = { isDebug: false, parseOnLoad: true, baseUrl: './', modulePaths: {'test' : '.'} }; </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js"></script> <script type="text/javascript" src="test.js"></script> <script> dojo.require('dijit.layout.BorderContainer'); dojo.require('dijit.layout.ContentPane'); dojo.require('test.testWidget'); dojo.ready(function() { var widget = new test.testWidget({}, 'widgetGoesHere'); }); </script> </head> <body class="tundra"> <div id='widgetGoesHere'></div> </body> </html>
testWidget.js
dojo.provide('test.testWidget'); dojo.require('dijit._Widget'); dojo.require('dijit._Templated'); dojo.require('dijit.layout.BorderContainer'); dojo.require('dijit.layout.ContentPane'); dojo.declare('test.testWidget', [ dijit._Widget, dijit._Templated], { templatePath: dojo.moduleUrl('test', 'testWidget.html'), widgetsInTemplate: true, postCreate: function() { this.inherited(arguments); } });
testWidget.html
<div id="page" dojoType="dijit.layout.BorderContainer" liveSplitters="true" design='sidebar' style="height:100%;"> <div dojoType="dijit.layout.ContentPane" region='center'> test center </div> <div dojoType="dijit.layout.ContentPane" region='left' style="width:50%"> test left </div> </div>
Sorry for the rather detailed code, but I donโt know why it doesnโt work, so I canโt describe my problem in simple words.
There are two panels in jist, an area on the left (area = "center" in this case) and a "right" panel in which I can put the contents of the widget. The above code just displays text in windowless divs.
Dfowj source share