I have an app that is utilizing a Tab navigation component (not a Tab Container), and it seems there is no way to explicitly set the selected tab and show the Tab selected on the UI.
The Tab Container provides such methods (e.g. setCurrentViewIndex), but not the Tab navigation component. The closest thing that the Tab component has is setValue which does it's job but will not show the set tab as selected in the UI.
I'm using Navigation Tabs because it can be connected to a data source, which is a feature I need. The Tab Container doesn't seem to allow this.
Is there something I'm missing? Can we expect more methods for this component in the future? Any plans to allow Data Source to Tab Container?
As a work-around, I've discovered that I can maintain a (hidden) text input field to hold the Tab value, populate that field based on my system logic, and then map the Default Value of the tab to this value.
First, awesome workaround. I had to do a similar hidden type thing for setting pagination values so it's neat to see others finding creative ways to get things done.
Second, have you tried to get the value property out from the tabs.data array? I was able to map these using a variable array with a name property like this:
...and used that as the source for my Tab component:
After that, the button is able to call upon the value of the data to use by name, which seems to trigger the UI to update the active tab:
Depending on how you are setting up these buttons, I am pretty sure you can target whatever you need once you know the index/key.
Thanks, pyrho. After looking at your code, I realized that I was setting the value to the value of the Label. Setting the value to the value of "Value" works as expected.
Regrettably, I was doing it wrong, but fooled because the tab was getting selected in some regard because I was seeing UI experience as if the tab was selected in the background. I should have shown my button's event code.
I will select your explanation as the Solution. Thanks again.