Jaxel
Well-known member
So XenForo has a built in Tabs control system using jQuery that I am implementing as follows:
This is working perfectly. The `TabNames` control the data panes in `TabChats`.
The problem comes in when I try to add tabs to this tab control through ajax:
This does add the tab elements to the page properly, however it does not register them as part of the jQuery tab control. Using information that @Chris D provided me with here (#115873), I attemped to reregister the tab control as follows:
Unfortunately the code above is not working at all and it is not registering the new tabs. Anyone got any ideas what I need to do to register XenForo.Tabs after page load?
Code:
<div class="sectionMain sectionChat">
<ul id="TabNames" class="tabs mainTabs Tabs" data-panes="#TabChats > li">
<xen:foreach loop="$channels" value="$channel">
<li><a href="{$requestPaths.requestUri}#tabChat_{$channel.id}">{$channel.name}</a></li>
</xen:foreach>
</ul>
<ul id="TabChats" class="chatFix">
<xen:foreach loop="$channels" value="$channel">
<li>{xen:raw $channel.chat}</li>
</xen:foreach>
</ul>
</div>
This is working perfectly. The `TabNames` control the data panes in `TabChats`.
The problem comes in when I try to add tabs to this tab control through ajax:
Code:
$("#TabNames").append(e.ajaxData.templateHtml);
$("#TabChats").append("<li>"+e.ajaxData.chatHtml+"</li>");
This does add the tab elements to the page properly, however it does not register them as part of the jQuery tab control. Using information that @Chris D provided me with here (#115873), I attemped to reregister the tab control as follows:
Code:
XenForo.activate($(".sectionChat"));
Unfortunately the code above is not working at all and it is not registering the new tabs. Anyone got any ideas what I need to do to register XenForo.Tabs after page load?