BoldDesk®Customer service software with ticketing, live chat & omnichannel support, starting at $99/mo for unlimited agents. Try for free!
<ejs-tab id='element'>
<e-tabitems>
<e-tabitem :header='headerText0' :content="content0"></e-tabitem>
<e-tabitem :header='headerText1' :content="content1"></e-tabitem>
<e-tabitem :header='headerText2' :content="content2"></e-tabitem>
</e-tabitems>
</ejs-tab>
Hi M.Vinitha devi
Thank you for your sample, it's exactly what I'm looking for. The only thing I'm flagging is when I try to reach the route through the url, the correct tab isn't selected.
Ivan
Hi Ivan,
We have checked the reported issue in previously shared sample. But, reported tab selected issue not occurs from our end. Could you please share the below details to reproduce the issue? This will help to validate the issue and provide prompt solution at earliest.
Hi Satheesh :)
Thank you for the reply. To replicate the issue in the above sample. Add a router path to the url in the browser window.
DefaultMenu.vue:
export default Vue.extend({ name: "DefaultMenu", data() { return { index: 1, isLoadRoutingContentWatch: false, isLoadRoutingContentEvent: false, headerText0: { text: "Angular" }, headerText1: { text: "Javascript" }, headerText2: { text: "Service" }, }; }, watch: { $route(to, from) { if (to.path === "/angular") { this.$refs.tabInstance.select(0); } else if (to.path === "/javascript") { this.$refs.tabInstance.select(1); } else if (to.path === "/services") { this.$refs.tabInstance.select(2); } this.StartRouting(to.path); }, }, methods: { loadRoutingContent(args) { var urlData; if (args.selectedIndex === 0) { urlData = "/angular"; } else if (args.selectedIndex === 1) { urlData = "/javascript"; } else if (args.selectedIndex === 2) { urlData = "/services"; } this.StartRouting(urlData); }, StartRouting: function (path) { if (path && this.$route.path !== path) { //Performs routing... this.$router.push(path); } }, }, }); </script> |
Hi Satheesh,
https://www.syncfusion.com/downloads/support/common/4794/ze/syncfusion_tabs_movie.mp4_40bf57fb.zip I have shared a screen recording of the sample with the watch option. I had to zip in since your file upload doesn't support mp4. Looks like its tab selected for a sec before in reverts back.
Hi Ivan,
Your reported issue only occurs in code sandbox sample preview and the same works fine if we open the same output in the individual browser tab. So, we prepare a local sample with same codes, and it works as expected. Try the shared sample and let us know if you need any further assistance.
Regards,
Vijay Ravi
And how would this be accomplished in Vue 3 composition api where the ref is on the component? I tried converting your example but the tabinstance isn't available on the ref $el. Thank you.
DefaultMenu.vue:
<template> <div> <div class="control_wrapper"> <ejs-tab id="tab_default" ref="Tab_instance" heightAdjustMode="Auto" :selected="loadRoutingContent" ref="tabInstance"> <e-tabitems> <e-tabitem :header="headerText0" :content="idv1"></e-tabitem> <e-tabitem :header="headerText1" :content="idv1"></e-tabitem> <e-tabitem :header="headerText2" :content="idv1"></e-tabitem> </e-tabitems> </ejs-tab> <div id="idv1"> <router-view></router-view> </div> </div> </div> </template> <script> import Vue from "vue"; import Vuex from "vuex"; import { TabPlugin } from "@syncfusion/ej2-vue-navigations"; import { ref } from "vue"; Vue.use(TabPlugin); Vue.use(Vuex); const Tab_instance = ref(null); export default Vue.extend({ name: "DefaultMenu", data() { return { index: 1, isLoadRoutingContentWatch: false, isLoadRoutingContentEvent: false, headerText0: { text: "Angular" }, headerText1: { text: "Javascript" }, headerText2: { text: "Service" }, }; }, watch: { $route(to) { var tabObj = Tab_instance.value.$el.ej2_instances[0]; if (to.path === "/angular") { tabObj.select(0); } else if (to.path === "/javascript") { tabObj.select(1); } else if (to.path === "/services") { tabObj.select(2); } else { tabObj.select(0); } this.StartRouting(to.path); }, }, methods: { loadRoutingContent(args) { var urlData; if (args.selectedIndex === 0) { urlData = "/angular"; } else if (args.selectedIndex === 1) { urlData = "/javascript"; } else if (args.selectedIndex === 2) { urlData = "/services"; } this.StartRouting(urlData); }, StartRouting: function (path) { if (path && this.$route.path !== path) { //Performs routing... this.$router.push(path); } }, }, }); </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style></style> |
$el.ej2_instances[0] Is returning Undefined
I have created a ticket, please and thank you.
Hi Ivan,
Thanks for your update.
We will check and update the details in the ticket.
Regards,
Satheesh Kumar B