0
votes

I have an app that trying to use dojox.calendar.Calendar in a Worklight 5.0.6 hybrid app using dojo. I've added calendar-layer.js.compressed.js to my build-dojo.xml file for the both the copy and dojo.resources.layers.

    <patternset id="dojo.resources.layers">
            <include name="dojo/dojo.js.compressed.js"/>
            <include name="dojo/core-web-layer.js.compressed.js"/>
            <include name="dojo/calendar-layer.js.compressed.js"/>
    </patternset>

    <copy todir="${build.dir}">
        <fileset dir="${dojo.root}">
            <include name="dojo/mobile-compat-layer.js.compressed.js"/>
            <include name="dojo/mobile-ui-layer.js.compressed.js"/>
            <include name="dojo/calendar-layer.js.compressed.js"/>
        </fileset>
        <mapper refid="dojo.resources.mapper"/>
    </copy>

In my main html file I've included the layer for calendar.

<body id="content" style="display: none">

<script src="js/initOptions.js"></script>
<script src="js/bobCAT.js"></script>
<script src="js/messages.js"></script>
<script src="dojo/calendar-layer.js"></script>

Using the rich html editor, I've added the calendar Dojox Widget from Palette into a simple dialog.

        <div  data-dojo-type="dojox.mobile.SimpleDialog" id="select-week-dialog">
            <div data-dojo-type="dojox.mobile.Heading"
                data-dojo-props="label:'Select Week'"></div>
            <div id="select-week-dialog-calendar" data-dojo-type="dojox.calendar.Calendar"></div>
            <div align=center>
                <button id="select-week-dialog-ok" data-dojo-type="dojox.mobile.Button" style="width:100%;height:40px">OK</button>
                <button id="select-week-dialog-cancel" data-dojo-type="dojox.mobile.Button" style="width:100%;height:40px">Cancel</button>
            </div>
        </div>

When I build then launch the app. I'm seeing the following in the console.

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8090/apps/services/preview/bobCAT/iphone/1.0/default/dojox/calendar/Calendar.js

Any help would be greatly welcomed.

2

2 Answers

2
votes

For those who are interested, I took sometime to other night to dive deeper into this and was able to get both dojox.mobile.Calendar and dojox.calendar.Calendar working. In the end I created my own calendar widget. The dojox.calendar.Calendar was very restrictive, the fonts were defined down to the pixel level and it did not scale well. dojox.mobile.Calendar worked better, but the UI I was looking for was to have the week selected as a whole instead of the day.

To get it working you need to update the build-dojo.xml to make sure the needed CSS, html templates, and javascript. A lot of it was looking through the JS that is included and then in chrome see what files were missing from the console messages. See snippet below:

    <!-- copy dojox.mobile -->
    <copy todir="${build.dir}">
        <fileset dir="${dojo.root}">
            <include name="dojox/mobile/bookmarkable.js"/>
            <include name="dojox/mobile/deviceTheme.js"/>
            <include name="dojox/mobile/migrationAssist.js"/>
            <include name="dojox/mobile/mobile-all.js"/>
            <include name="dojox/mobile/themes/**"/>
            <include name="dijit/themes/**"/>
            <include name="dojox/calendar/**"/>
            <include name="dojox/html/**"/>     
            <include name="dojo/cldr/**"/>
            <include name="dojox/widget/**"/>
            <include name="dijit/icons/images/**"/>
        </fileset>
    </copy>
0
votes

Not sure about the purpose of you application, but have you tried using dojox.mobile.Calendar instead dojox.calendar.Calendar?