jquery - 表内表折叠未正确显示
问题描述
我有一个表,我在基表中使用折叠。现在,当我在表崩溃中创建一个新表然后查看部分不平衡时会发生什么情况,目前还不清楚,但是当我从一个部分中删除表并写一些看起来很完美的东西时会发生什么。我不知道这个问题。那么,我该如何解决这个问题呢?请帮我。
<table class="table table-hover js-basic-example dataTable table-custom m-b-0">
<thead>
<tr>
<th>Job ID</th>
<th>Job Title</th>
<th>Deadline</th>
<th>Lead</th>
<th>Team</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr data-toggle="collapse" data-target="#resume">
<td>
<h6>jobi765243</h6>
</td>
<td class="project-title">
<h6>InfiniO 4.1</h6>
<small>Created 14 July, 2018</small>
</td>
<td>8 Aug, 2018</td>
<td><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar1.jpg" data-toggle="tooltip" data-placement="top" title="Team Lead" alt="Avatar" class="width35 rounded"></td>
<td>
<ul class="list-unstyled team-info">
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar1.jpg" data-toggle="tooltip" data-placement="top" title="Avatar" alt="Avatar"></li>
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar2.jpg" data-toggle="tooltip" data-placement="top" title="Avatar"></li>
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar3.jpg" data-toggle="tooltip" data-placement="top" title="Avatar"></li>
</ul>
</td>
<td class="project-actions">
<a href="project-detail.html" class="btn btn-sm btn-outline-primary"><i class="icon-eye"></i></a>
</td>
</tr>
<div class="body collapse" id="resume" >
<div id="wizard_horizontal">
<h2>Received</h2>
<section>
<table class="table">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>class</th>
<th>roll</th>
</tr>
</thead>
<tbody>
<tr class="collapse">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</tbody>
</table>
</section>
<h2>Shortlisted</h2>
<section>
<p>Donec </p>
</section>
<h2>Interview</h2>
<section>
<p> Morbi </p>
</section>
<h2>Final Status</h2>
<section>
<p> Quisque at sem turpis</p>
</section>
<h2>Offer Letter</h2>
<section>
<p> Quisque at sem turpis </p>
</section>
</div>
</div>
</tbody>
谢谢你
解决方案
问题是表格中div#resume的 HTML 结构是错误的。这意味着,tbody元素只能包含tr元素作为其子元素。因此,您可以修改结构如下:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<table class="table table-hover js-basic-example dataTable table-custom m-b-0">
<thead>
<tr>
<th>Job ID</th>
<th>Job Title</th>
<th>Deadline</th>
<th>Lead</th>
<th>Team</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr data-toggle="collapse" data-target="#resume">
<td>
<h6>jobi765243</h6>
</td>
<td class="project-title">
<h6>InfiniO 4.1</h6>
<small>Created 14 July, 2018</small>
</td>
<td>8 Aug, 2018</td>
<td><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar1.jpg" data-toggle="tooltip" data-placement="top" title="Team Lead" alt="Avatar" class="width35 rounded"></td>
<td>
<ul class="list-unstyled team-info">
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar1.jpg" data-toggle="tooltip" data-placement="top" title="Avatar" alt="Avatar"></li>
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar2.jpg" data-toggle="tooltip" data-placement="top" title="Avatar"></li>
<li><img src="<?php echo base_url(); ?>company/assets/images/xs/avatar3.jpg" data-toggle="tooltip" data-placement="top" title="Avatar"></li>
</ul>
</td>
<td class="project-actions">
<a href="project-detail.html" class="btn btn-sm btn-outline-primary"><i class="icon-eye"></i></a>
</td>
</tr>
<tr>
<td colspan="6">
<div class="body collapse" id="resume">
<div id="wizard_horizontal">
<h2>Received</h2>
<section>
<table class="table">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>class</th>
<th>roll</th>
</tr>
</thead>
<tbody>
<tr class="collapse">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</tbody>
</table>
</section>
<h2>Shortlisted</h2>
<section>
<p>Donec </p>
</section>
<h2>Interview</h2>
<section>
<p> Morbi </p>
</section>
<h2>Final Status</h2>
<section>
<p> Quisque at sem turpis</p>
</section>
<h2>Offer Letter</h2>
<section>
<p> Quisque at sem turpis </p>
</section>
</div>
</div>
</td>
</tr>
</tbody>
推荐阅读
- laravel - 如何在 Laravel 中创建用户?
- c++ - 将调用哪个构造函数?
- drools - 在流口水中,当满足第一个条件时(假设我有 3 个),我想在规则中跳过“何时”部分到“那么”
- dart - 具有列表的 Null 感知运算符
- php - 如何从php中的arraylist中读取数据
- javascript - Mozilla“恢复上一个会话”与登录验证
- c# - 无法连接到远程主机
- c++ - 如果数组的第一个值设置为空终止符,C++ 是否可以安全地使用字符数组?
- database - 在 presto、hive 中查询数组结构
- java - 在 Web3j 以太坊交易中设置十六进制编码的数据字段