Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Set focus to added igx-tabs
posted

When a tab is created dynamically, I want to set focus to the newly created tab.

Top Replies

Parents
No Data
Reply
  • 2680
    Offline posted

    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

Children