Hello,
New CesiumView removes dojo. But I want to use dijit/form/Button in CesiumView. Dijit Button is usually imported by 'require', but CesiumView import modules by define. I've tried this,
define([
...
'../../ThirdParty/dojo-release-1.9.0/dijit/form/Button',
...
], function(
...
Button,
...) {
alert(Button);//Button is undefined!!!!
}
Could somebody help me to import dijit button?
Thanks,
Shawn
Yes, the latest CesiumViewer application switched away from Dojo for simplicity, but since Cesium is built using standard AMD modules, it still works great with Dojo.
To switch the CesiumViewer application over to Dojo, change the index.html to replace:
with:
Change CesiumViewerStartup.js to configure the location of the dojo and dijit packages:
/global require/
require({
baseUrl : ‘…/…/Source’,
paths : {
CesiumViewer : ‘…/Apps/CesiumViewer’
},
packages : [{
name : ‘dojo’,
location : ‘…/ThirdParty/dojo-release-1.9.1/dojo’
}, {
name : ‘dijit’,
location : ‘…/ThirdParty/dojo-release-1.9.1/dijit’
}]
}, [‘CesiumViewer/CesiumViewer’], function() {
});
In CesiumViewer.js, replace:
‘domReady!’
with:
‘dojo/domReady!’
Then, you can add more dependencies on ‘dijit/form/Button’ or any other dojo or dijit module you’d like to use.
Scott
Are you sure you have your paths correct? I just followed these instructions and everything worked as expected. The only thing I had to change was the references to 1.9.1 since we now ship with 1.9.3.
I think the irrational path error occurs when you try and index a directory that is above the website root directory but that’s just a guess on my part since I can’t recreate the issue.