添加折叠tr
时,数据表无效。如果remvoe崩溃tr
,那么数据表正常工作如何解决它任何人都可以帮助
提前谢谢......
$('.tableToggleUl').parent('td').css('padding','0px');
$('.tableToggleUl').hide();
$('.tableToggleBtn').click(function(){
$(this).parents('tr').next('tr').find('.tableToggleUl').toggle();
$(this).toggleClass('fa-plus-circle, fa-minus-circle');
});
$('.tableToggleBtn').next('.iconConfirmedAppointments, .fa-clock-o, .iconPracticeRescheduled').css('float','left');
$('.tableToggleBtn').parent('td').css('width','65px');
$(document).ready(function () {
$('.btnApptSuggestion').on("click",function(){
$validator = $('#frmSuggestionAppt').validate();
$validator.resetForm();
var AppID=$(this).data('value');
var patientID=$(this).data('patient');
var parentId=$(this).data('parentid');
var AppointmentDate=$(this).data('sugdate');
$('#SuggestionAppointmentID').val(AppID);
$('#SuggestPatientID').val(patientID);
$('#SuggestOtherPatientID').val(parentId);
$('#dateAppointment').val(AppointmentDate);
});
try
{
var dTable = $('.reportTable').DataTable({
"paging": true,
"bSortable": false,
"lengthChange": true,
"bRetrieve": true,
"bProcessing": true,
"bDestroy": true,
"searching": true,
"ordering": false,
"info": true,
"autoWidth": true,
"responsive": true,
"aLengthMenu": [[20, 30, 50], [20, 30, 50]]
});
}
catch(e)
{
}
});

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<table class="table table-bordered table-hover dr-table datatable reportTable dataTable no-footer" id="DataTables_Table_0">
<thead>
<tr>
<th style="padding-left:36px;" class="sorting_disabled">Status</th>
<th style="white-space: nowrap;" class="sorting_disabled">Slot Type</th>
<th class="sorting_disabled">Professional</th>
<th class="sorting_disabled">Patient</th>
<th class="sorting_disabled">Date & time</th>
<th class="sorting_disabled">Checked In</th>
<th class="sorting_disabled">Checked Out</th>
<th class="sorting_disabled">Action</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td style="width: 65px;"><span class="glyphicon glyphicon-plus tableToggleBtn" style="cursor:pointer;"></span><div class="icon iconConfirmedAppointments"
style="float: left;"></div></td>
<td><div class="icon iconPatientWithSlot"></div></td>
<td>Dr. Doctor Testing </td>
<td>
<a href="/doctor/patient_detail?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D">
Miss. Kratika Aggrawal Sr.
</a>
</td>
<td>July 19 2017 - 11:00 AM</td>
<td>
</td>
<td>
</td>
<td>
<div class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-pencil fa-lg"></i>
<span class="caret"></span>
</a>
<style>
@media only screen and (min-width:150px) and (max-width:991px) {
.table .dropdown-menu {
left: 0px !important;
}
}
</style>
<ul class="dropdown-menu">
<li>
<input type="hidden" value="77" class="Status">
<input type="hidden" value="8886" class="ID">
<input type="hidden" class="ParentPatientID">
<a class="lnkChangeStatus" href="#" style="width:auto;">Appointment Status</a>
</li>
<li>
<input type="hidden" value="8886" class="ID">
<a href="/doctor/dr_otherappointment?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D" style="width:auto;">Outgoing Referrals</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td colspan="8" style="padding: 0px;">
<ul class="tableToggleUl">
<li>
<label>Report Status</label>
<span></span>
</li>
<li>
<label>Record Uploaded</label>
<span>No</span>
</li>
<li>
<label>Order Received</label>
<span>No</span>
</li>
<li>
<label>Authorization</label>
<span>No</span>
</li>
<li class="tableRow1Height">
<label>Care Plan Uploaded</label>
<span>No</span>
</li>
<li>
<label>Guardian Name</label>
<span></span> </li>
<li>
<label>Referred By</label>
<span>Miss. Kratika Aggrawal Sr. (Patient)</span>
</li>
<li>
<label>Insurance</label>
<span></span>
</li>
<li>
<label>Visit Reason</label>
<span>abdominal Pain</span>
</li>
<li>
<label>How Did Hear</label>
<span>Market Place</span>
</li>
<li>
<label>Location</label>
<span> Tester Rd Snohomish Washington 98290</span>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
&#13;
答案 0 :(得分:0)
$(document).ready(function() {
$(".tableToggleBtn-tr").click(function(){
$(".tableToggleUl-td").toggle();
});
$('.btnApptSuggestion').on("click", function() {
$validator = $('#frmSuggestionAppt').validate();
$validator.resetForm();
var AppID = $(this).data('value');
var patientID = $(this).data('patient');
var parentId = $(this).data('parentid');
var AppointmentDate = $(this).data('sugdate');
$('#SuggestionAppointmentID').val(AppID);
$('#SuggestPatientID').val(patientID);
$('#SuggestOtherPatientID').val(parentId);
$('#dateAppointment').val(AppointmentDate);
});
try {
var dTable = $('.reportTable').DataTable({
"paging": true,
"bSortable": false,
"lengthChange": true,
"bRetrieve": true,
"bProcessing": true,
"bDestroy": true,
"searching": true,
"ordering": false,
"info": true,
"autoWidth": true,
"responsive": true,
"aLengthMenu": [
[20, 30, 50],
[20, 30, 50]
]
});
} catch (e) {
}
});
.tableToggleUl-td { display: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<table class="table table-bordered table-hover dr-table datatable reportTable dataTable no-footer" id="DataTables_Table_0">
<thead>
<tr>
<th style="padding-left:36px;" class="sorting_disabled">Status</th>
<th style="white-space: nowrap;" class="sorting_disabled">Slot Type</th>
<th class="sorting_disabled">Professional</th>
<th class="sorting_disabled">Patient</th>
<th class="sorting_disabled">Date & time</th>
<th class="sorting_disabled">Checked In</th>
<th class="sorting_disabled">Checked Out</th>
<th class="sorting_disabled">Action</th>
</tr>
</thead>
<tbody>
<tr role="row" class="tableToggleBtn-tr">
<td style="width: 65px;"><span class="glyphicon glyphicon-plus tableToggleBtn" style="cursor:pointer;"></span>
<div class="icon iconConfirmedAppointments" style="float: left;"></div>
</td>
<td>
<div class="icon iconPatientWithSlot"></div>
</td>
<td>Dr. Doctor Testing </td>
<td>
<a href="/doctor/patient_detail?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D">
Miss. Kratika Aggrawal Sr.
</a>
</td>
<td>July 19 2017 - 11:00 AM</td>
<td>
</td>
<td>
</td>
<td>
<div class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-pencil fa-lg"></i>
<span class="caret"></span>
</a>
<style>
@media only screen and (min-width:150px) and (max-width:991px) {
.table .dropdown-menu {
left: 0px !important;
}
}
</style>
<ul class="dropdown-menu">
<li>
<input type="hidden" value="77" class="Status">
<input type="hidden" value="8886" class="ID">
<input type="hidden" class="ParentPatientID">
<a class="lnkChangeStatus" href="#" style="width:auto;">Appointment Status</a>
</li>
<li>
<input type="hidden" value="8886" class="ID">
<a href="/doctor/dr_otherappointment?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D" style="width:auto;">Outgoing Referrals</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td colspan="8" style="padding: 0px;" class="tableToggleUl-td">
<ul class="tableToggleUl">
<li>
<label>Report Status</label>
<span></span>
</li>
<li>
<label>Record Uploaded</label>
<span>No</span>
</li>
<li>
<label>Order Received</label>
<span>No</span>
</li>
<li>
<label>Authorization</label>
<span>No</span>
</li>
<li class="tableRow1Height">
<label>Care Plan Uploaded</label>
<span>No</span>
</li>
<li>
<label>Guardian Name</label>
<span></span> </li>
<li>
<label>Referred By</label>
<span>Miss. Kratika Aggrawal Sr. (Patient)</span>
</li>
<li>
<label>Insurance</label>
<span></span>
</li>
<li>
<label>Visit Reason</label>
<span>abdominal Pain</span>
</li>
<li>
<label>How Did Hear</label>
<span>Market Place</span>
</li>
<li>
<label>Location</label>
<span> Tester Rd Snohomish Washington 98290</span>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<script enter code heresrc="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
希望它的工作
答案 1 :(得分:0)
正如您在Allan的回复中所看到的那样:DataTables and colspan。
数据表不支持colspan
。这样做的原因在于它与过滤和排序的交互方式是一个非常重要的问题(例如,如何对具有跨越多列的元素的列进行排序 - 该数据属于哪一列?第一个,还是全部? - 同样的问题笼罩着过滤)。
您正在使用colspan
,我们可以在此处看到:
<td colspan="8" style="padding: 0px;" class="tableToggleUl-td">
这就是数据表无法正常工作的原因。
虽然现在不能选择,但您可以使用他们的Complex headers。如果你想合并表头。