How can I directly link to a certain (AJAX) tab on a view page? - Forum - Rollbase - Progress Community

How can I directly link to a certain (AJAX) tab on a view page?

 Forum

How can I directly link to a certain (AJAX) tab on a view page?

This question is answered

Is there a way to have a direct hyperlink to a view page where a different tab is loaded than the default (first / last visited).
So can I create a direct link to that tab on that page?

Verified Answer
  • The defect is described in https://knowledgebase.progress.com/articles/Article/rbf-activatePageTab-not-working-in-On-load-event.

    In addition to the earlier coded solution, Vimal sent us this workaround for the onLoad event, that does cause some UI glitches, since the content of the last tab is loaded first and then switched to the selected tab (in the URL):

    var tabIndex = 1; // write logic to get tab index
    if(rbf_isNewUI()){
      rb.newui.page.PageContext.getCanvasEl().one(rb.newui.util.customEvents.rbs_tabActivated, function() {
          rbf_activatePageTab(tabIndex);
      });
    }
    

  • I didnt know about the issue with onload and activateTab. Sorry for the misleading statement.

    To solve the UI issue you can use an IIFE that is placed within a template text field. Use the token of the template field in script components placed on top of all of your tabs.

    The code inside of the template would look like this:

    (function(){

       var tabIndex = 1; // write logic to get tab index

       rbf_activatePageTab(tabIndex);

    })();

    And in each script component {!temp_field}

    Just make sure the scripts are on top of each tab so it loads immediately without waiting for other page components

    Hope that helps.

    Read about IIFE in javascript for more ideas

All Replies
  • I have a code solution for this if you are interested. See below:

    1. Generate your link to a record's view page (ex. Link to view page of an object >> {!#LINK.case})

    2. Add a custom parameter at the end (ex. {!#LINK.case}&tab=2)

    3. In my example i'm using a number to indicate the tab index, on the view page onload property (obj def > view page > properties) add script to read your custom parameter and load the tab:

    ex.

    var currURL = String(window.location.href), tabIndex = parseInt(currURL.split("tab=")[1]); //get tab index from URL

    if ( !isNaN(tabIndex) ) { //have some sort of checker to handle URLs without custom param

           rbf_activatePageTab(tabIndex); //Load your tab using the API

    }

    From here you just need to generate a URL to your view page and add a custom parameter and value at the end and that could more or less be considered a direct link to one of your tabs.

    Hope that helps.

  • Hi Ruben,

    If you are looking for a landing page configuration after login, we have a feature to configure landing page for each role or a user.

    1. User level configuration

    profile settings->My preferences->landing page configuration

    2. Role level configuration

    Administration setup->roles->pages->assign landing page

  • That was an unexpected answer.

  • Unfortunately the rbf_activatePageTab doesn't seem to work in a View Page onLoad event. This is a known issue which will be resolved in the next release. We have tried adding a page listener, but that doesn't work either. There is definitely an issue with the rbf_activatePageTab API.

  • Hi Ruben/Harold,

    Unfortunately this is not possible today. I request you to log an enhancement request or put it under idea section. As Harold said there is an issue in using rbf_activatePageTab() method in view page onLoad method in NewUI.

    Thanks,

    Vimal.

  • The defect is described in https://knowledgebase.progress.com/articles/Article/rbf-activatePageTab-not-working-in-On-load-event.

    In addition to the earlier coded solution, Vimal sent us this workaround for the onLoad event, that does cause some UI glitches, since the content of the last tab is loaded first and then switched to the selected tab (in the URL):

    var tabIndex = 1; // write logic to get tab index
    if(rbf_isNewUI()){
      rb.newui.page.PageContext.getCanvasEl().one(rb.newui.util.customEvents.rbs_tabActivated, function() {
          rbf_activatePageTab(tabIndex);
      });
    }
    

  • I didnt know about the issue with onload and activateTab. Sorry for the misleading statement.

    To solve the UI issue you can use an IIFE that is placed within a template text field. Use the token of the template field in script components placed on top of all of your tabs.

    The code inside of the template would look like this:

    (function(){

       var tabIndex = 1; // write logic to get tab index

       rbf_activatePageTab(tabIndex);

    })();

    And in each script component {!temp_field}

    Just make sure the scripts are on top of each tab so it loads immediately without waiting for other page components

    Hope that helps.

    Read about IIFE in javascript for more ideas