【发布时间】:2017-12-19 21:05:23
【问题描述】:
如何在同一页面中使用数据表,我使用模板数据表但是当我创建新的数据表时不起作用。
这是我的代码
CSS:
<link href="<?php echo base_url();?>/assets/plugins/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo base_url();?>/assets/plugins/datatables/buttons.bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo base_url();?>/assets/plugins/datatables/responsive.bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo base_url();?>/assets/plugins/datatables/scroller.bootstrap.min.css" rel="stylesheet" type="text/css"/>
JavaScript:
<!-- Datatable js -->
<script src="<?php echo base_url();?>/assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>/assets/plugins/datatables/dataTables.bootstrap.js"></script>
<script src="<?php echo base_url();?>/assets/plugins/datatables/dataTables.buttons.min.js"></script>
代码: 不,当我用这个数据表创建一个新的时,所有功能都不起作用..
echo "<table id='datatable-buttons' class='table display2 table-striped table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>No.</th>";
echo "<th>Itemset</th>";
echo "<th>Jumlah</th>";
echo"</tr>";
echo "</thead>";
echo "<tbody>";
foreach ($item_array as $ia_key => $ia_value)
{
//$theitems = explode('|',$ia_key);
for($x = 0; $x < count($ia_key); $x++)
{
if (($ia_value>=$support))
{
$no++;
echo "<tr>";
echo "<td> $no </td>";
echo "<td> $ia_key </td>";
echo "<td> $ia_value </td>";
$z++;
echo "</tr>";
}
}
}
echo "</tbody>";
echo "</tr>";
echo "</table>";
【问题讨论】:
-
我可以看看你是如何在 js 中初始化数据表的吗?
-
Docs 不工作?
-
您需要确保您的表格具有唯一的 ID
-
该链接将不起作用,因为您将类名设置为 display2。 DataTables 需要类名“display”
-
我收回,你正在使用引导程序
标签: javascript php css codeigniter codeigniter-3