Multi level collapsable/accordion that goes on infinitely without breaking table content
I am trying to make a multi-level accordion with tables inside it that can have any number of levels.
this is my requirement
I'm still a noob so I've tried some other stuff on code pen which had unlimited nesting but the CDN or something seems to break my layout but I finally found
one that works and now my layout looks like this(base level) (expanded) but the table gets broken.
My current Code is a mess so id like to know if there is a clean way to do it, current full code:
https://pastebin.com/PBTDhxyY
Accordion Code(base level):
<div class="row product-listing">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body nested-accordion">
<div class="row mt-10">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel-group" id="level1-accordion">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#level1-accordion" href="#plast-pro-1" class="collapsed">
<table class="table">
<tr>
<td>LEVEL 1</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</div>
<div id="plast-pro-1" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-unstyled">
<li>
<div class="panel-group" id="level2-accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2-accordion" href="#plast-pro-2" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<li>
<div class="panel-group" id="level2test" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2test" href="#level2testlink" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<!-- ------------------------------------------------------------------------------------------------------------------------------------------------- -->
<li>
<div class="panel-group" id="level2testb" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2testb" href="#level2testlinkb" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
javascript html css twitter-bootstrap
add a comment |
I am trying to make a multi-level accordion with tables inside it that can have any number of levels.
this is my requirement
I'm still a noob so I've tried some other stuff on code pen which had unlimited nesting but the CDN or something seems to break my layout but I finally found
one that works and now my layout looks like this(base level) (expanded) but the table gets broken.
My current Code is a mess so id like to know if there is a clean way to do it, current full code:
https://pastebin.com/PBTDhxyY
Accordion Code(base level):
<div class="row product-listing">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body nested-accordion">
<div class="row mt-10">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel-group" id="level1-accordion">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#level1-accordion" href="#plast-pro-1" class="collapsed">
<table class="table">
<tr>
<td>LEVEL 1</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</div>
<div id="plast-pro-1" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-unstyled">
<li>
<div class="panel-group" id="level2-accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2-accordion" href="#plast-pro-2" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<li>
<div class="panel-group" id="level2test" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2test" href="#level2testlink" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<!-- ------------------------------------------------------------------------------------------------------------------------------------------------- -->
<li>
<div class="panel-group" id="level2testb" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2testb" href="#level2testlinkb" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
javascript html css twitter-bootstrap
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56
add a comment |
I am trying to make a multi-level accordion with tables inside it that can have any number of levels.
this is my requirement
I'm still a noob so I've tried some other stuff on code pen which had unlimited nesting but the CDN or something seems to break my layout but I finally found
one that works and now my layout looks like this(base level) (expanded) but the table gets broken.
My current Code is a mess so id like to know if there is a clean way to do it, current full code:
https://pastebin.com/PBTDhxyY
Accordion Code(base level):
<div class="row product-listing">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body nested-accordion">
<div class="row mt-10">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel-group" id="level1-accordion">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#level1-accordion" href="#plast-pro-1" class="collapsed">
<table class="table">
<tr>
<td>LEVEL 1</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</div>
<div id="plast-pro-1" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-unstyled">
<li>
<div class="panel-group" id="level2-accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2-accordion" href="#plast-pro-2" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<li>
<div class="panel-group" id="level2test" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2test" href="#level2testlink" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<!-- ------------------------------------------------------------------------------------------------------------------------------------------------- -->
<li>
<div class="panel-group" id="level2testb" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2testb" href="#level2testlinkb" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
javascript html css twitter-bootstrap
I am trying to make a multi-level accordion with tables inside it that can have any number of levels.
this is my requirement
I'm still a noob so I've tried some other stuff on code pen which had unlimited nesting but the CDN or something seems to break my layout but I finally found
one that works and now my layout looks like this(base level) (expanded) but the table gets broken.
My current Code is a mess so id like to know if there is a clean way to do it, current full code:
https://pastebin.com/PBTDhxyY
Accordion Code(base level):
<div class="row product-listing">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body nested-accordion">
<div class="row mt-10">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel-group" id="level1-accordion">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#level1-accordion" href="#plast-pro-1" class="collapsed">
<table class="table">
<tr>
<td>LEVEL 1</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</div>
<div id="plast-pro-1" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-unstyled">
<li>
<div class="panel-group" id="level2-accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2-accordion" href="#plast-pro-2" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<li>
<div class="panel-group" id="level2test" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2test" href="#level2testlink" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
<!-- ------------------------------------------------------------------------------------------------------------------------------------------------- -->
<li>
<div class="panel-group" id="level2testb" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#level2testb" href="#level2testlinkb" aria-expanded="true" aria-controls="plast-pro-2">
<table class="table">
<tr>
<td>LEVEL 2</td>
<?php
for ($k = 0 ; $k < 11; $k++){
echo '<td> </td>';
}
?>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</table>
</a>
</h4>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
javascript html css twitter-bootstrap
javascript html css twitter-bootstrap
edited Nov 20 '18 at 8:01
Dilip Borad
169417
169417
asked Nov 20 '18 at 7:56
Man In The WallMan In The Wall
167
167
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56
add a comment |
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388507%2fmulti-level-collapsable-accordion-that-goes-on-infinitely-without-breaking-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388507%2fmulti-level-collapsable-accordion-that-goes-on-infinitely-without-breaking-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
“but the table gets broken” - you don’t have a “the” table here, you have many individual, independent tables. And of course they each individually size based on their content - because they have no connection to each other. You either need to specify the column widths you want - or not rip this apart into multiple tables in the first place. (Then you can’t use default BS accordion functionality, but will have to implement something similar based on showing/hiding table rows yourself.)
– misorude
Nov 20 '18 at 8:56