I have two screens, A and B.
On Screen A, there are six tabs. When I click on any tab, it navigates to Screen B. After completing my work on Screen B, when I return to Screen A, a new page loads, and I am directed to a different tab instead of the same tab from which I navigated.
The requirement is: when I return to Screen A, it should automatically open the same tab from which I navigated to Screen B.
Hello @Akash Yadav ,
You can achieve your use-case by following these steps:
Create a Client Variable
Begin by defining a client variable (e.g., ScreenTab) to store the currently selected tab.
Update the Client Variable on Tab Change
Initialize the Active Tab on Load
I also attached an example OML.
I used this method and it is working fine but,
when i am going next tab with same URL it is going last tab where i worked.
so we need to make client variable 0 after we close current tab.( exception is it should go on 0th tab not 2,3,4,5,6)
how ?
I don't understand the title of this question. Seems in no relation to the actual question.
Hello Akash,
It seems you already know that this could be managed through client variable, then what is your questions here? Are you stuck somewhere with that impelmentation?
Junaid
under Navigation tab i have DEPRECATED_TabsV2 block but OnTabChange having only one input variable.
please check below attachment.
Hi,
It seems you need to learn about using input variables so that when the value changes, you can control and display what you want using a condition.
Best regards!
To achieve this behavior in OutSystems 11, you need to store the active tab state before navigating to Screen B and restore it when returning to Screen A. Here’s how you can implement it:
Solution Approach
1. Store the Active Tab Before Navigating to Screen B
2. Retrieve and Set the Active Tab When Returning to Screen A
Implementation Steps
Step 1: Save Active Tab Before Navigating to Screen B
localStorage.setItem("ActiveTab", document.querySelector(".tab-active").id);
Step 2: Restore Active Tab When Returning to Screen A
var activeTab = localStorage.getItem("ActiveTab");if (activeTab) { document.getElementById(activeTab).click();}
Alternative: Using OutSystems Client Variables
Hi Akash Yadav,
You can handle this scenario as an input parameter for both ScreenA and ScreenB.
please check below attachment. Demolink.
I think I understand you very well. You want to come back to the older page A and you want to open the tab which was opened at the time of leaving the page. You want to do it using client variable.
Below are the steps -:
1). Have a local variable on screen A name it tabIdentifier.
2). When you click on your tab (say tab_3) assign tabIdentifier=tab_3.3). ScreenB should have a non mandatory input parameter (say cameFromTab). At the time of redirecting to ScreenB assign cameFromTab=tabIdentifier.4). ScreenB should also have a local variable cameFromTabLOC.
5). At the time of screen initialization of screen B assign cameFromTabLOC=cameFromTab.
6). Now your screen A should also have a non-mandatory input parameter named IPSelectedTab.
7). At the time of redirecting back to A (from B) assign IPSelectedTab=cameFromTabLOC (on screen B)
8). In screen A initialization, check if IPSelectedTab is set, then assign tabIdentifier=IPSelectedTab.
9). Now based on the local variable tabIdentifier you can render the tab you want.
This is how you can achieve your objective based on local variable (without using client var).Thanks,Sant
you need to store your selected tab value in the client variable and when you return to the page use the client variable value in OnReady event.
If you want to load the same tab even user close the browser then you can use database to store the value and use that value in OnReady event.