When a tab is created dynamically, I want to set focus to the newly created tab.
Hello Brenda,
Thank you for posting to Infragistics Community!
My suggestion is to set the selectedIndex property of the tabs component in code with adding each tab. It could be set to the length of its items collection minus 1, or whatever collection represents your tabs objects, for example an array.
Here is a small Stackblitz sample demonstrating this.
Please, note that setting the selected index is wrapped within a setTimeout hanlder with a minimal interval to avoid timing issues when adding a tab, that is, to make sure it exists and is properly bound prior to assigning the selected index.
Please, test the sample on your side and let me know of any other questions on the matter.
Best regards, Bozhidara Pachilova Associate Software Developer
Thanks.
getting the following error:
TypeError: Cannot set properties of undefined (setting 'selectedIndex')
Never mind. Found the issue.
Hi Brenda,
I am glad that you were able to achieve your requirement. Thank you for using Infragistics components!
Best regards, Bozhidara Pachilova