As David Leedy got into trouble with Dojo 1.8.1 and jQuery Mobile 1.3.1 and after reading the follow up from Ulrich Krause with the analysis of the problem, I thought that this problem is caused from the AMD loader of Dojo. That’s why I changed the loading order (by forcing the jQuery libraries to get loaded before Dojo), and this seems to work.
I have tested it in IE 8, FF 20.0 and Chrome 26.0.
Here is my test XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.properties>
<xp:parameter
name="xsp.resources.aggregate"
value="true" />
</xp:this.properties>
<xp:this.resources>
<xp:styleSheet
href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<xp:headTag
tagName="script">
<xp:this.attributes>
<xp:parameter
name="type"
value="text/javascript" />
<xp:parameter
name="src"
value="http://code.jquery.com/jquery-1.9.1.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag
tagName="script">
<xp:this.attributes>
<xp:parameter
name="type"
value="text/javascript" />
<xp:parameter
name="src"
value="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js" />
</xp:this.attributes>
</xp:headTag>
</xp:this.resources>
<div
data-role="page"
class="jqm-demos"
data-quicklinks="true">
<div
data-role="content"
class="jqm-content"
id="contentRefresh">
<h2
id="accordion-markup">
<script>document.write(dojo.version)</script>
</h2>
<div>
<div
data-role="collapsible-set"
data-theme="c"
data-content-theme="d">
<div
data-role="collapsible">
<h3>Section</h3>
<p>
<xp:label
value="#{javascript:java.lang.System.currentTimeMillis()}"
id="labelRefresh" />
</p>
</div>
</div>
</div>
<a
href="#"
onclick="XSP.partialRefreshGet('#{id:labelRefresh}')"
data-role="button">Refresh Label</a>
</div>
</div>
</xp:view>
And this is the result:
The XSP object is loaded correctly and Partial Refreshs are executed correctly:
It is required that the resource aggregation is enabled. More details can be found here.
Great catch!
Pingback: Next jQuery Mobile Hurdle | Notes In 9
Thanks for posting this! Is there any way you can think of to get this working from inside a theme?
I can’t see a way, because you can not add a headTag component with a theme out of the box.
When „Any way“ means an acceptable effort 🙂