JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Docking Layout › Activate tab over API
- This topic has 4 replies, 2 voices, and was last updated 3 years, 6 months ago by Jozef.Lukac.
-
AuthorPosts
-
April 26, 2021 at 3:59 pm #101745Jozef.LukacMember
Hello,
We want to activate (select and focus) the tab “TAB 3” over API.
Can you give some advices?
Best regards
Jozef.April 27, 2021 at 2:10 pm #101751yavordashewMemberHi Jozef,
Thank you for contacting us!
Because DockingLayout component uses the Window Component we can use its API to select the tab you want.
Quick example on how to do this:window.onload = function () { const docking = document.querySelector('smart-docking-layout'); docking.layout = [ { //The Base Group type: 'LayoutGroup', orientation: 'horizontal', items: [ { //DockingLayout Item B label: 'TabsWindow B', size: '25%', items: [{ //Tab Item B1 of Item B label: 'Tab B1', selected: true, id: 'clickEvent12321312', content: 'Content of B1' }, { //Tab Item B2 of Item B label: 'Tab B2', content: 'Content of B2', }], id: 1, tabCloseButtons: true }, ] } ]; setTimeout(() => { docking.items[0].select(1) }, 1000);
More info about this you can find in the window API here https://www.htmlelements.com/docs/window-api/
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/April 28, 2021 at 7:34 am #101756Jozef.LukacMemberThank you Yavor,
this solution worsk at angular for tab switching.
But it works differently as selection by mouse.
This can select(tabIndex) tab correctly, however whole docking.items[dockIndex] looks not selected.
Best regards,
Jozef.April 28, 2021 at 4:57 pm #101762yavordashewMemberHi Josef,
I have another code snippet for you in which we use the nativefocus
method like so:that.dockinglayout.items[0].select(1) that.dockinglayout.items[0].focus()
Let me know if that works for you!
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/April 29, 2021 at 11:04 am #101767Jozef.LukacMemberThank you Yavor,
Yours code snippet works for us, as simple as it looks.
Regards,
Jozef. -
AuthorPosts
- You must be logged in to reply to this topic.