[resolved] C57 tabs (ccm_activateTabBar)

Permalink
I'm opening a view in a dialog with the following code:

<?php
echo \Core::make('helper/concrete/ui')->tabs(array(
    array('general', 'Prijsinstellingen', true),
    array('description', 'Omschrijving')
));
?>
<div class="ccm-tab-content" id="ccm-tab-content-general">
   A
</div>
<div class="ccm-tab-content" id="ccm-tab-content-description">
   B
</div>


This works fine, because the helper runs a JS function (ccm_activateTabBar) to make the tabs works. But, when I close the dialog and open it again, all the ccm-tab-content divs are invisible and they won't become visible when I click a tab header.

What is going wrong? Any ideas?

A3020
 
A3020 replied on at Permalink Best Answer Reply
A3020
I've found the issue. I was using something like this:

$.post(CCM_DISPATCHER_FILENAME + '/toolfile, opts, function(data) {
   const $el = $('<div class="dialog"/>').html(data);
   $.fn.dialog.open({
       width: 450,
       height: 400,
       modal: true,
      element: $el
   });
});


which causes that the dialog's html isn't removed from the DOM after the dialog has been closed. And this resulted in multiple div's with the same ID.

It's better to use the "href" property in the dialog function. However, it doesn't support POST requests.