Open Closed

Ajax calls firing when switching tabs in modal window #7473

rucksackdigital created


Running v7.0.0 with MVC/jQuery stack. I'm running into an odd issue that I can't seem to track down.

What's happening is:

  • I've modified some of my edit modals to have multiple tabs, allowing better organization of information being edited. modals have standard .modal-body
  • Inside of my modal body I have a tab panel with standard class=tabbable-line, ul.nav-tabs, and
  • Whenever I switch tabs, the service tied to the dataTable population on the main page is triggered.

I've tried tracking this down but haven't had success yet. Has anyone else experienced this behavior?

2 Answer(s)
  • 0
    maliming created

    hi @rucksackdigital

    Can you share some code to help me reproduce this problem?

  • 0
    rucksackdigital created

    @maliming I was actually able to track this down to how I was handling datatables inside of modal windows:

     $(document).on('', 'a[data-toggle="tab"]', function (e) {
                    $($.fn.dataTable.tables(true)).css('width', '100%');

    I added this code due to an issue with datatables in hidden tabs not spanning the width of their container. Removed the code and problem resolved itself.