tabPanel selectedIndexChanged isn't firing

Posted by: ed on 8 March 2019, 3:01 pm EST

  • Posted 8 March 2019, 3:01 pm EST

    I want to execute some code when the user clicks the tabPanel and changes the selected tab. I have added the following eventlistener

    document.getElementById(‘theTabPanel’).addEventListener(‘selectedIndexChanged’, function(e) {

    alert(‘Hi’);

    });

    When I select a different tab the selectedIndexChanged doesn’t fire. If I change the event to ‘click’, my alert executes.

    Thanks, Ed

  • Posted 11 March 2019, 12:33 am EST

    Hi Ed,

    The issue is arising because you are using addEventListener method to bind to the event. Since selectedIndexChanged is not a standard event, the handler is never executed. For wijmo events, we need to need to addHandler() method on the event like:

    var tPanel = new wijmo.nav.TabPanel('#theTabPanel');
     tPanel.selectedIndexChanged.addHandler(function(s,e){
     	console.log('tab changed. Current tab index: '+ s.selectedIndex);
     });
    

    Please refer to the following doc for more info about wijmo events: https://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/static/events.html

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels