[dojox/app] How to make TabBar's syncWithViews work?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[dojox/app] How to make TabBar's syncWithViews work?

PaulChristopher
dojox/app/test/multiSceneApp has a fixed tabbar at the bottom. Everything works fine. However if you click the browser's back button, the last view is loaded, but the highlighted icon in the tabbar stays the same, i.e. the tabbar still displays the last view, i.e. the tabbar is not updated on hitting the back button.

I just saw, that dojox/mobile/Tabbar has a property "syncWithViews". Alas, it does not work with dojox/app, since syncWithViews listen for

this.subscribe("/dojox/mobile/afterTransitionIn", f);
this.subscribe("/dojox/mobile/startView", f);

to sync the selected tab with the view but dojox/app does not publish those topics. Looking through the code of dojox/app, I could not find any topic that is published on view transition, but internal events only?

So I was wondering, how to make my tabbar listen to app-transition events and update the selected tab accordingly? Or would it be better if dojox/app in general does also publish known dojox/mobile topics?
Reply | Threaded
Open this post in threaded view
|

Re: [dojox/app] How to make TabBar's syncWithViews work?

edchat2
Hi,
   In the next release (2.0) we are hoping to merge the transitions used in dojox/app with the ones used by dojox/mobile, so hopefully that will solve this problem.  For now I guess you will not be able to take advantage of syncWithViews unless you want to try to fire the events yourself.  You may be able to set a param on the transition with the selected tab and use that know which tab should be selected as you transition forward and backward.
Regards,
Ed


On Mon, Apr 22, 2013 at 1:37 PM, PaulChristopher <[hidden email]> wrote:
dojox/app/test/multiSceneApp has a fixed tabbar at the bottom. Everything
works fine. However if you click the browser's back button, the last view is
loaded, but the highlighted icon in the tabbar stays the same, i.e. the
tabbar still displays the last view, i.e. the tabbar is not updated on
hitting the back button.

I just saw, that dojox/mobile/Tabbar has a property "syncWithViews". Alas,
it does not work with dojox/app, since syncWithViews listen for



to sync the selected tab with the view but dojox/app does not publish those
topics. Looking through the code of dojox/app, I could not find any topic
that is published on view transition, but internal events only?

So I was wondering, how to make my tabbar listen to app-transition events
and update the selected tab accordingly? Or would it be better if dojox/app
in general does also publish known dojox/mobile topics?



--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojox-app-How-to-make-TabBar-s-syncWithViews-work-tp3995986.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: [dojox/app] How to make TabBar's syncWithViews work?

PaulChristopher
Hi Ed,

thank you very much for your response! Just so, that at the moment only HistoryHash.js does publish "topics":

topic.publish("/app/history/back", {"viewId": target, "detail": detail});
[HistoryHash.js, line 237]

If I have time, I'll add a patch for History.js on the tracker, since at the moment, History.js does not publish any topic. With 2.0, we could then change the topics to dojox/mobile compliant ones (or publish them additionally?)

BTW, have you seen http://bugs.dojotoolkit.org/ticket/17056 ? I think something is broken with the pushState/popState. Moving backwards and forwards works nicely, however the transitions are not stored correctly as far as I can see. I think the main problem is, that saving a state with pushState and then clicking browser back does not retrieve the last saved state but the state before that state. The last saved state is the current state.

Reply | Threaded
Open this post in threaded view
|

Re: [dojox/app] How to make TabBar's syncWithViews work?

PaulChristopher
Mmmh, strange. I have just tried to bind on the "app-transition" event via the global app object (after the app/status "started" topic has been published), but I do get no console logs at all when changing views:

multiSceneApp.on('app-transition', function(){
    console.log('We have a transition!!!');
});

If I debug the global multiSceneApp object, I can see that it has an onapptransition function, but binding to the event via "on" seems to have no effect.

Don't know why. I'll patch those publish topic stuff now in the core source code...