一个简单的解决方案,我在jQuery中正在寻找删除所有表行,除了隐藏的行中的表。在这里,我试图与基层(我是新来这个赦免我。)。
$("#example-datatable tbody tr:not(:hidden)").remove();
HTML代码:
<table id="example-datatable" class="table draggable table-striped table-bordered table-vcenter">
<thead>
<tr>
<th>Account Name</th>
<th>Meeting Date</th>
<th>Start Time</th>
<th>No Of Hours</th>
<th>Project</th>
<th>Status</th>
<th>Created By</th>
<th>Created On</th>
<th>Modified By</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<!-- Define the Template TR to Clone for rest of the Rows -->
<tr style="display:none">
<td>accountName</td>
<td>meetingDate</td>
<td>startTime</td>
<td>no_of_hours</td>
<td>projectName</td>
<td>IsActive</td>
<td>employeeDisplayName</td>
<td>createdDate</td>
<td>employeeDisplayName</td>
<td class="text-center">
<!--Buttons Binded here with primarykey ID-->
</td>
</tr>
</tbody>
</table>
只需使用
$("#example-datatable tbody tr").not(":hidden").remove();