Languages

Menu
Sites
Language
TAU and page managing
Hello, I have a question. I'm developing an app but I don't know how can I go two or more pages back or how can I go to the main app page without passing via midsteps. Example: Page flow in main app: Main list -> proper object list -> proper object details -> specific details. I'm on Specific Details screen and after that, I would like to go back to the Main List directly (without jumping via object details -> object list -> main list screens). How can I achieve that? Does the tizen have an option like that (go back more than one page or simply go to proper screen and after that clearing TAU "page screen history"? Thanks in advance! Have a nice day!

Responses

7 Replies
André Reus

Hi, At first declare pages like these... 'first' and 'two' are two different pages. 

<div class="ui-page ui-page-active" id="first">
   <div class="ui-content">
      <a href="#two">Go to page two</a>
   </div>
</div>

<div class="ui-page" id="two">
   <div class="ui-content">
      <a href="#first">Go to page one</a>
   </div>
</div>

You can control routing using these id's ...you have to use changePage to route to a specific page like below 

 tau.changePage("two");

If you want to simple go back to previous page use, 

tau.back();

So if you want to direct go to MainList from specific details..

tau.changePage("MainList");

Let me know the result ... 

dmrugalski

André Reus, Thanks, you're right, I know that.

You wrote:

So if you want to direct go to MainList from specific details..

tau.changePage("MainList");
And It's OK, but after that action (after open main app list from any of details) i need to disable ability to go back to the previous page (so to the details in our example).
André Reus

Hi, check this.... if have to write code here for your logic for specific page. 

    window.addEventListener("tizenhwkey", function (ev) {
		var activePopup = null,
			page = null,
			pageid = "";

		if (ev.keyName === "back") {
			activePopup = document.querySelector(".ui-popup-active");
			page = document.getElementsByClassName("ui-page-active")[0];
			pageid = page ? page.id : "";

			if (pageid === "main" && !activePopup) {
				try {
					tizen.application.getCurrentApplication().exit();
				} catch (ignore) {
				}
			}
                        else if(pageid == "YOUR_PAGE"){
                        // YOUR LOGIC. 
                        }  
                        else {
				window.history.back();
			}
		}
	});

 

dmrugalski

Andre Reus, 

thanks, but again, it's nothing useful for me I think... Because I don't have an idea what should it be in "// YOUR LOGIC" place to achieve my aim...

I can't believe that Tizen don't have an ability to clear "stackview" history or go back two or more pages in the same time....

André Reus

Say, you just came from "Details" to "Main"..... on the "Main" user clicks on back button again. So you have to check 

else if(pageid == "Main"){

}

Also you need to check the previous page.....if the previous page is "Details"...block the routing.... its simple ! 
Hope you understand now.... 

 

dmrugalski

So, it's meaning I have to manually stored previous page in any variable? There is no default mechanism for that functionality?

André Reus

Yes.....so far i don't know better idea than it !