数据表删除行按钮 [英] DataTables remove row button
本文介绍了数据表删除行按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让我的脚本在按下定位按钮"后完全删除该行.我有以下代码,但是我似乎无法让它正常工作.是的,DataTables 中的表名被命名为dataTables-example".
I am trying to have my script delete the row completely once the "locatebutton" has been pressed. I have the following code however I cannot seem to get it working right. Yes, the table name within DataTables is named "dataTables-example".
按钮:
<td><button type="button" name="locateButton1" class="btn btn-info" onClick="UpdateLocate(<?php echo $orow['wo']; ?>);"/>Locates</button></a></td>
脚本:
<script>
function UpdateLocate(wo)
{
jQuery.ajax({
type: "POST",
url: "functions/markLocates.php",
data: 'wo='+wo,
cache: false,
success: function(response)
{
//alert("Record successfully updated");
$('#dataTables-example').on( 'click', 'a.editor_remove', function (e) {
e.preventDefault();
editor
.title( 'Edit record' )
.message( "Are you sure you wish to delete this row?" )
.buttons( { "button": "locateButton1", "fn": function () { editor.submit() } } )
.remove( $(this).closest('tr') );
} );
}
});
}
推荐答案
我能够通过以下方式实现这一点
I was able to accomplish this with the following
$("#dataTables-example").on('click', '.btn-info', function () {
$(this).parent().parent().remove();
});
这篇关于数据表删除行按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文