Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set the default tab within a tabs container?

Kathleen Janiszewski
Contributor
January 17, 2024

I have a tabs container which contains 4 tabs each with a TableView macro inside.  I simply want to set the default tab depending on the date.  I can hardcode it for now, but I'd like to do it programmatically using JavaScript, eventually.  Is there an easy way to do this either on the Tabs Container macro or on the Tabs themselves?

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
January 18, 2024

Hi

Unsre what "tabs" component are you using, but the one from Atlassian allows to switch between tabs using the "anchor" in the url

https://aui.atlassian.com/aui/latest/docs/tabs.html#tabs-example-second

Alex

Kathleen Janiszewski
Contributor
January 19, 2024

Alex,

Thank you.

I've had to add the line:

AJS.tabs.change(jQuery(`a[href="${currentFYandQtrStr}"]`));

to my AJS.toInit() function, so that works.  It just doesn't look nice, because the default is the first Tabs Page.  I was hoping there might be a way to simply use the id of the Tabs Page in the Tabs Container to set the default.

Any ideas?  If not, this is sufficient, just not pretty.

Thank you in advance.

-Kathleen J

Alex Medved _ConfiForms_
Community Champion
January 22, 2024

Not sure why you could not do that with the same approach!?

And selecting any other tab

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events