Change tab with a button

hi I have in tabbedcontainer1 > tabs1 > "Home" "view" "calendar"

how do I change tabs1 to "view" using a button with

query:
{{tabbedContainer1.viewKeys['1']}}
or
{{tabbedContainer1.setCurrentViewIndex['1']}}

but does not change tabs1 > view

Hi welcome to the community.

If I'm understanding the question you want to change the view based on a button press?
The tabs component you describe is essentially that, a bunch of buttons that can change the view of a container.

A button event handler should allow you to set the viewIndex or viewKey, or you can use javascript, as you seem to be using in your example code. There's some syntax issues with what you posted though, which may explain why it's not working.

setViewIndex is a function and requires a number, relating to the index in the array of views (0 being the first one) eg
tabbedContainer1.setCurrentViewIndex(1) would switch to the second view in your tabbed container
not
tabbedContainer1.setCurrentViewIndex['1'] (note the type of brackets and quote marks)

If you want to change it by key, not index value, then setCurrentView('view') should be what you're after.

I'd suggest you start by using the built in "Control component" options on the button if you're having trouble doing this from a script/query:
image

1 Like