Remember selected tab

It would be great if we could have a Tab selected, go to an edit page and then return to have the same Tab selected. @Chem

Hey @cremar, this can be done for the time being using some custom JavaScript.

Here’s an example of how that will look.

Step 1
Find the component ID for the Table component. In my example, that would be component_3, as shown in the image below.

Step 2

Add the following code to the JavaScript section of your page.

TB.render('component_ID',function(data){
   var lastTabSelected = parseInt(localStorage.getItem('lastSelectedTab'));
   data.ele.find('.tab- a').each(function(i,ele){
        if (i === lastTabSelected){
            $(ele).click();
        }
        $(ele).click(function(){
            localStorage.setItem('lastSelectedTab', i);
        });
    });
});

Please remember to change component_ID in the first line of the code to your component ID, as shown in Step 1.

1 Like

Thanks for the code @Chem (I didn’t realize you had answered) but this isn’t working for me. Any thoughts as to why? Am I needing to add something else that would seem obvious to anyone but me?

@cremar, do you mean the tabs on tables or the tabbed navigation as in here?

@Markj I mean the tabs on tables.