In addition to the 'back' button functioning as expected, I need to asynchronously invoke a function to update some db tables and refresh the UI.

Prior to making this post, I did some research and tried the following on this...

<h1 data-dojo-type="dojox.mobile.Heading" id="hdgSettings" data-dojo-props="label:'Settings',back:'Done',moveTo:'svStart',fixed:'top'"></h1>

dojo.connect(dijit.registry.byId("hdgSettings"), "onclick",   
    function() {
        if (gblLoggerOn) WL.Logger.debug(">> hdgSettings(onclick) fired...");
        loadTopLvlStats();
}); 

Since my heading doesn't have any other widgets than the 'back' button, I thought that attaching this event to it would solve my problem... it did nothing. So I changed it to this...

dojo.connect(dijit.registry.byId("hdgSettings")._body, "onclick",   
    function() {
        if (gblLoggerOn) WL.Logger.debug(">> hdgSettings(onclick) fired...");
        loadTopLvlStats();
}); 

As it turns out, the '._body' attribute must be shared by the Accordion widget that I just happen to use as my app's main UI component, and any attempt to interact w the Accordion rendered my entire app useless.

As a last resort, I guess I could simply forgo using the built-in 'back' button, and simply place my own tabBarButton on the heading to control my app's transition and event processing.

If the community suggests that I use my own tabBarButton, then so be it, however there has to be a way to cleanly attach an event to the built-in 'back' button support.

Thoughts?

有帮助吗?

解决方案

The following should do the trick:

var backButton = dijit.registry.byId("hdgSettings").backButton;
if (backButton) {
  dojo.connect(backButton, "onClick", function() { ... });
}

Remarks:

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top