我在单页中有两个表具有相同的类,生成的表的数据是服务器端处理的。
看看下面的代码。
PHP代码
<table class="table table-striped display" id="somedetailList" >
<thead>
<tr>
<th>some Name</th>
<th>some Adress</th>
<th>some Mobile</th>
<th>some Name</th>
<th>some da</th>
<th>some as</th>
<th>some ds</th>
</tr>
</thead>
<tbody>
<?php foreach ($ros as $row) { ?>
<tr>
<td><?php echo $row->partyname; ?></td>
<td><?php echo $row->address; ?></td>
<td><?php echo $row->phonenumber; ?></td>
<td><?php echo $row->name ?></td>
<td><?php echo $row->total; ?></td>
<td><?php echo $row->advance; ?></td>
<td><?php echo $row->balance; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<table class="table table-striped display" id="vehicledetailList" >
<thead>
<tr>
<th>Party Name</th>
<th>Party Adress</th>
<th>Party Mobile</th>
<th>Driver Name</th>
<th>Total</th>
<th>Advance</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<?php foreach ($balan as $bal) { ?>
<tr>
<td><?php echo $bal->partyname; ?></td>
<td><?php echo $bal->address; ?></td>
<td><?php echo $bal->phonenumber; ?></td>
<td><?php echo $bal->name ?></td>
<td><?php echo $bal->total; ?></td>
<td><?php echo $bal->advance; ?></td>
<td><?php echo $bal->balance; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
表格的脚本在下面
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery('table.display').DataTable();
});
</script>
即使我完全像这个小提琴一样尝试,然后我也得到同样的问题,我为每张桌子获得了多个分页框。
请帮忙。