我只是想尝试使用JQuery Datatable显示表。 它工作正常,直到我添加嵌套表。
这是表格:
<table id="owner_report" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Owner Name</th>
<th>Status</th>
<th>Call Date</th>
<th>Proposal Number </th>
<th>Proposal Date </th>
<th>Quotation Number </th>
<th>Quotation Date </th>
<th>From Date</th>
<th>To Date</th>
<th>Payment Date</th>
<th>Cheque Number</th>
<th>Amount</th>
<th>Remarks</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Owner Name</th>
<th>Status</th>
<th>Call Date</th>
<th>Proposal Number </th>
<th>Proposal Date </th>
<th>Quotation Number </th>
<th>Quotation Date </th>
<th>From Date</th>
<th>To Date</th>
<th>Payment Date</th>
<th>Cheque Number</th>
<th>Amount</th>
<th>Remarks</th>
</tr>
</tfoot>
<tbody>
<?php
if(!empty($owners_array)) {
foreach($owners_array as $ownersReport) {
$ownersRecord = $ownersReport;
$ownersDetailList = get_post_meta($ownersRecord->ID, 'machineOwnerArray', true);
?>
<tr>
<td><?php echo $ownersDetailList['ownerName'];?></td>
<td><?php echo $ownersDetailList['status'];?></td>
<td><?php echo $ownersDetailList['callDate'];?></td>
<td><?php echo $ownersDetailList['proposalNumber'];?></td>
<td><?php echo $ownersDetailList['proposalDate'];?></td>
<td><?php echo $ownersDetailList['quotationNumber'];?></td>
<td><?php echo $ownersDetailList['quotationDate'];?></td>
<td><?php echo $ownersDetailList['fromDate'];?></td>
<td><?php echo $ownersDetailList['toDate'];?></td>
<td><?php echo $ownersDetailList['paymentDate'];?></td>
<td><?php echo $ownersDetailList['chequeNumber'];?></td>
<td><?php echo $ownersDetailList['amount'];?></td>
<td><?php echo $ownersDetailList['remarks'];?></td>
<td>
**<table>
<thead>
<tr>
<th> just testing </th>
<th> just testing </th>
<th> just testing </th>
<th> just testing </th>
</tr>
</thead>
<tbody>
<tr>
<td> just testing </td>
<td> just testing </td>
<td> just testing </td>
<td> just testing </td>
</tr>
</tbody>
</table>**
</td>
</tr><?php
}
}
wp_reset_postdata();
?>
</tbody>
</table>
Jquery没有奇特的东西:
<script type="text/javascript">
jQuery(document).ready(function($) {
var table=$('#owner_report').DataTable();
}
此外,如果有任何其他方式,我可以在行中添加第二个表格,只有在点击该行时才会显示。