Mobile How to use Javascript API NaviateTo

Hello, 

I found the javascript API https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/Navigation

and would like to try  to use the api: NavigateTo which have a following option:

(Optional) replace: boolean

Indicates if the navigation should replace the current history entry, instead of creating a new one that the user can navigate back to. If a value is not provided, the default is false

------------------------------------------------------------------------------------------------


----------------------------------------------------------------------

In my sense, I have believed that it should work when I click the button NavigateTo (True), I hope it works like naviageback button.

Please somebody help

Hi Jongmin Choi,

Consider you have your two screens Home and Home2.

NavigationHistory stores the list of screens you've been going through; and CurrentScreenIndex stores the zero-based index of the currently displayed screen, in the NavigationHistory. Those methods affect these two values differently:

  • When you start your application and land on Home:
    • NavigationHistory: {Home}
    • CurrentScreenIndex: 0
  • When you then click on "Button" and navigate to Home2:
    • NavigationHistory: {Home, Home2}
    • CurrentScreenIndex: 1
  • Depending on which button you click from Home2 you have different behaviours:
    1. When you click on "Back" (assuming it is using NavigateBack):
      • NavigationHistory: {Home, Home2}
      • CurrentScreenIndex: 0
    2. When you click on "NavigateToTrue"
      • NavigationHistory: {Home, Home}
      • CurrentScreenIndex: 1
    3. When you click on "NavigateToFalse"
      • NavigationHistory: {Home, Home2, Home}
      • CurrentScreenIndex: 2

In 1. you will be able to call NavigateForward, but not in 2. nor 3.

So, NavigateTo will change the value of your NavigationHistory, whereas NavigateBack and NavigateForward will only change the current screen being displayed.