Question
· Jul 18, 2016

Zen Mojo - Method Push and Pop

I have two pages and I am using the push and pop to go and back navigation. When I click the button forward and back in the browser, I can't navigate more between pages.

 

The following code:

Page 1 - onSelect Method:
var obj = {idExame: VALID, objUsu: ObjUsu};
zenPage.gotoArea ('itemexames', key, key, false);
view.pushDocument (key, obj, key, obj);


Page 2 - onSelectMethod, back:

var documentKey = "PacienteExamesinitial";
var layoutKey = "PacienteExamesinitial";
var area = "pacienteexames";

view.popDocument ();
zenPage.gotoArea (area, layoutKey, documentKey, false);

 

I am using ZenMojo with Bootstrap.

Can someone help me?

Thanks

Alexandre Marques

Discussion (4)0
Log in or sign up to continue

I agree with  Eduard Lebedyuk answer bellow that, SPA don´t work with browser back/forward buttons and consequently with the browser history. 

However, I noticed that the pushDocument has a parameter 'nohistory' that uses the mechanism  history.pushState when set as 'true'. It is available on  %ZEN.Mojo.basePage. I did some test in order to try to help Alexandre and i have noticed that after you pushDocument, popDocument, than click on back or forward browser buttons and than try to pushDocument once again, it does not work correctly as it was. 

Does anybory has any thoughts about that?

I agree with  Eduard Lebedyuk answer bellow that, SPA don´t work with browser back/forward buttons and consequently with the browser history. 

However, I noticed that the pushDocument has a parameter 'nohistory' that uses the mechanism  history.pushState when set as 'true'. It is available on  %ZEN.Mojo.basePage. I did some test in order to try to help Alexandre and i have noticed that after you pushDocument, popDocument, than click on back or forward browser buttons and than try to pushDocument once again, it does not work correctly as it was. 

Does anybory has any thoughts about that?

SPAs can work with the browser back and forward button if the URL is updated and the page is pushed to the history stack.  The page Eduard refers to actually mentions this. The jQuery Mobile plugins do implement and support this, you can verify this by opening

/csp/samples/ZMdemo.jQM145.HomePage.cls?

in your browser (point it to your local instance) and play with it.

Currently, our Bootstrap plugin implementation does not support this, because we only implemented a helper plugin and not a page manager. Page managers are responsible for the overall behavior of the SPA.