-
-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have some mui tabs coming dynamicaly , how can i activate the tabs from javascript #44
Comments
There's an undocumented feature which lets you activate tabs from JavaScript: mui.tabs.activate(paneId); |
yes ,I have checked that already, it lets you activate the tabs onebyone right, that too by passing pane id , if i have 20 sections , if each section has a tabbed content of which has say 3 tabs, |
I see... to activate the tab on page load you can use the <ul class="mui-tabs">
<li class="mui-is-active"><a data-mui-toggle="tab" data-mui-controls="pane-default-1">Tab-1</a></li>
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-2">Tab-2</a></li>
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-3">Tab-3</a></li>
</ul>
<div class="mui-tab-content">
<div class="mui-tab-pane mui-is-active" id="pane-default-1">Pane-1</div>
<div class="mui-tab-pane" id="pane-default-2">Pane-2</div>
<div class="mui-tab-pane" id="pane-default-3">Pane-3</div>
</div> There's a typo in the documentation which I'll fix ASAP. |
@mukuljp Did the CSS class fix your problem? |
@amorey , the html for the tabs is coming up via ajax, i gave a class to all tabs initialy (only to first tab).
and in activateThisTab function i added the mui.tabs.activate(paneId);
Overall its a hack :) i had to put unique ids and click handlers for every tab, it would have been easier if its done by class . |
I see. That works but using the <ul class="mui-tabs " >
<li class="mui-is-active"><a ng-click="activateThisTab('bla-' + p.program_numeric_id + '-1', null)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-1">Next Steps</a></li>
<li><a ng-click="activateThisTab('bla-' + p.program_numeric_id + '-2', null)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-2">Details</a></li>
<li><a ng-click="activateThisTab('bla-' + p.program_numeric_id + '-3', p.offices)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-3">Hours & Locations</a></li>
</ul> |
oh let me try that, |
Ok, let me know if it works. Just to clarify, you need to add the <ul class="mui-tabs " >
<li ><a class="mui-is-active" ng-click="activateThisTab('bla-' + p.program_numeric_id + '-1', null)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-1">Next Steps</a></li>
<li><a ng-click="activateThisTab('bla-' + p.program_numeric_id + '-2', null)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-2">Details</a></li>
<li><a ng-click="activateThisTab('bla-' + p.program_numeric_id + '-3', p.offices)" data-mui-toggle="tab" data-mui-controls="bla-{{p.program_numeric_id}}-3">Hours & Locations</a></li>
</ul>
<div class="mui-tab-content">
<div class="mui-tab-pane mui-is-active first_mui_tab_set" id="bla-{{p.program_numeric_id}}-1">
<div class="mui-panel">
</div>
</div>
<div class="mui-tab-pane" id="bla-{{p.program_numeric_id}}-2">
<div class="mui-panel">
</div>
</div>
<div class="mui-tab-pane" id="bla-{{p.program_numeric_id}}-3">
<div class="mui-panel">
</div>
</div>
</div> |
yes that worked , but in the documentation I found it was wrong at first . anyway its showing correctly now in https://www.muicss.com/docs/v1/css-js/tabs |
Great! I'm happy to hear it's working! |
No description provided.
The text was updated successfully, but these errors were encountered: