【发布时间】:2016-03-24 06:34:11
【问题描述】:
我正在使用 jquery.dataTables.rowReordering.js 插件对我的数据进行重新排序 Drag 正在工作,但 drop 不起作用,它会在鼠标离开时移动到相同的位置。下面是代码。
<table class="table-bordered table dataTable" id="hotbuystable">
<thead>
<tr>
<th>Image</th>
<th>Brand Name</th>
<th>Product Name</th>
<th>Priority</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
<?php $count=0; foreach($getHotBuys as $keys => $item) {
$count=$count+1;
$cid = $item['phone_id'];
echo "<tr data-position='$count' id='$cid'>";
echo "<td><img src='" . $item['image'] . "' width='50px' height='50px'></td>";
echo "<td>" . $item['brand_name'] . "</td>";
echo "<td>" . $item['product_name'] . "</td>";
echo "<td>" . $item['score'] . "</td>";
echo "<td id='$cid'><a href='#' class='rowtag' id='$cid'><i class=\"fa fa-times fa-1x\"></i></a></td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="assets/js/plugins/jquery.min.new.js"> </script>
<script type="text/javascript" src="assets/js/lib/jquery-ui.js"></script>
<script type="text/javascript" src="assets/js/plugins/jquery-select2/select2.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/jquery-datatables/jquery.dataTables.js"></script>
<script src="assets/js/lib/jquery.dataTables.rowReordering.js"></script>
jQuery(function ($) {
'use strict';
$('#hotbuystable').dataTable({
"bPaginate": false,
"bFilter": false,
"bInfo": false,
"bSort": false
}).rowReordering();
});
请您注意是什么错误。
【问题讨论】:
-
您能否提供一个带有最终 HTML 渲染(而不是 php 代码)的 JSFiddle 演示?
标签: php jquery datatables