Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging Label Attribute of Dojox.Mobile.Heading
    text
    copied!<p>I have a dojox.mobile site that has a common view. I would like to reuse the view for multiple "buttons" and call a function which changes the label of the view's heading depending on which button was pushed. However, when I change the innerHTML, the back button disappears. When I use the setattr function, the label doesn't change. What is the proper way to handle this?</p> <p> &lt;/link> --> Demo This Problem </p> <pre><code> &lt;div id="MainMenu" data-dojo-type="dojox.mobile.View" data-dojo-props="selected: true" style="width: 100%; height: 100%;"&gt; &lt;h1 data-dojo-type="dojox.mobile.Heading"&gt;View A&lt;/h1&gt; &lt;h2 dojoType="dojox.mobile.RoundRectCategory"&gt;Select a View&lt;/h2&gt; &lt;ul data-dojo-type="dojox.mobile.RoundRectList"&gt; &lt;li data-dojo-type="dojox.mobile.ListItem" data-dojo-props="rightText:'Go!', moveTo: 'generic_view_x', callback:SetupViewA"&gt; View A &lt;/li&gt; &lt;li data-dojo-type="dojox.mobile.ListItem" data-dojo-props="rightText:'Go!', moveTo: 'generic_view_x', callback:SetupViewB"&gt; View B &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="generic_view_x" data-dojo-type="dojox.mobile.View" style="width: 100%; height: 100%;"&gt; &lt;h1 id="view_x_header" data-dojo-type="dojox.mobile.Heading" data-dojo-props="back:'Main', moveTo:'MainMenu',label:'test'"&gt;&lt;/h1&gt; &lt;div id="map_canvas" style="width: 100%; height: 100%;"&gt; Some Other Stuff Here &lt;/div&gt; &lt;/div&gt; &lt;!-- configure and load dojo --&gt; &lt;script src="./dojo/dojo.js" data-dojo-config="async:1, mblAlwaysHideAddressBar:true"&gt;&lt;/script&gt; &lt;script&gt; require(["dojo"], function(dojo){ SetupViewA = function (){ // Doing it This way removes the back button // document.getElementById('view_x_header').innerHTML = 'View A'; // This doesn't change anything dojo.setAttr("view_x_header", 'label','View A') } SetupViewB = function (){ document.getElementById('view_x_header').innerHTML = 'View B'; } }) require(["dojox/mobile/parser", "dojox/mobile", "dojox/mobile/deviceTheme", "dojox/mobile/compat", "dojo/domReady!"], function(parser) { parser.parse(); }); &lt;/script&gt; &lt;/body&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload