How to navigate between tabs on Button click using Handler?

Hello Community,

 

I would like to switch tabs based on a user action using code in a handler. Is it possible to write code that opens a custom tab on the same page, as shown in the figure below?

 

On button click, I have implemented below code in the handler, but it is not working.

{
        request: "crt.OpenTab",
        handler: async (request) => {
            request.$context.set("SelectedTab", "CustomTab");
            request.$context.set("ActiveTab", "CustomTab");
            request.$context.profile.set("Tabs_SelectedTabIndex_Profile", 2);
        return true;
     }

}

 

Best regards,

Ajay Kuthe

 

 

Like 2

Like

2 comments

The attribute you need to set is the [TabControlName]_SelectrdTabIndex_Profile. If you tab control is named "TabPanel_fb0xrup", then the attribute you would set would be:

// select first tab
request.$context.TabPanel_fb0xrup_SelectedTabIndex_Profile = 0;

Note, the indexes are zero based.

Ryan

Also, to clarify, there is no "set" method in Freedom UI pages like there was in classic pages. You will just set and read values from the attributes directly as normal variables.

Show all comments