如何使用 jquery 数据表插件删除当前行 [英] How to delete current row with jquery datatable plugin

查看:23
本文介绍了如何使用 jquery 数据表插件删除当前行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 jQuery 数据表插件的表格中有一个带有按钮的列.按钮显示删除",意思是当您单击该按钮时,它会删除表格中的当前行.

I have a column with buttons in a table I'm using jQuery datatable plugin. The buttons say "Remove" and the idea is that when you click on that button it deletes the current row in the table.

当我调用 fnDeleteRow 时,它似乎是第一次工作,但该行没有任何进一步的时间,因此看起来它并没有真正正确地删除该行.

When I call fnDeleteRow it seems to work the first time but no any further time for that row so it looks like its not really deleting the row properly.

推荐答案

试试这个:

var row = $(this).closest("tr").get(0);
oTable.fnDeleteRow(oTable.fnGetPosition(row));

如果它不起作用,请检查以下example

If it doesn't work, check the following example

这篇关于如何使用 jquery 数据表插件删除当前行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆