额外的jquery不能在数据表分页中工作
additional jquery not works in datatable pagination
我有Datatable
和jquery插件,删除这个数据表
$(document).ready(function () {
$(".delete-ajax").live("click", function (e) {
e.preventDefault();
recordId = $(this).attr('id');
alert(recordId);
var requestAdress = '{!! route("admin.area.cities.destroy", ":id") !!}';
requestAdress = requestAdress.replace(':id', recordId);
$.ajax({
cache: false,
dataType: "json",
type: "delete"
, url: requestAdress
, date: {
"_token": "{{ csrf_token() }}",
"id": recordId
},
success: function () {
$('tr#' + recordId).fadeOut(300, 'linear');
}
}, "json");
});
});
代码的工作很好,但每当我改变页面在datatable
分页jquery插件。点击失败
Datatable网站:http://datatables.net
.live()的使用现在已折旧。使用事件委托:
$(document).ready(function () {
$(document).on("click",".delete-ajax", function (e) { // updated ths line
e.preventDefault();
recordId = $(this).attr('id');
alert(recordId);
var requestAdress = '{!! route("admin.area.cities.destroy", ":id") !!}';
requestAdress = requestAdress.replace(':id', recordId);
$.ajax({
cache: false,
dataType: "json",
type: "delete"
, url: requestAdress
, date: {
"_token": "{{ csrf_token() }}",
"id": recordId
},
success: function () {
$('tr#' + recordId).fadeOut(300, 'linear');
}
}, "json");
});
});
查看Live Removed
相关文章:
- 如何在emberjs中使用幻影假数据进行分页
- Javascript数组表分页
- 如何使用引导程序分页器库对从PHP返回的数据进行分页
- 如何使用javascript检测数据表分页的其他页面中的复选框
- JSF数据表分页中的当前页码
- 谷歌图表与动态数据和分页是可能的
- 如何使用php对mysql数据库中检索到的数据进行分页
- 数据表分页只能计算第一页的复选框
- 引导表分页和搜索不起作用
- 如何使用引导程序分页对数据进行分页
- 删除和恢复数据表分页点击功能
- 智能表分页链接不工作
- 自定义下拉筛选器和引导程序表分页刷新
- 使用Jquery对大数据进行表分页
- JQuery .on('click')不工作在数据表第二页或行过去11
- 与其他解决方案相比,内置的ng表分页在性能上存在问题
- Qooxdoo表与远程数据和分页支持
- 额外的jquery不能在数据表分页中工作
- 素数单选数据表分页 + 行索引变量
- 使用jquery插件和php进行动态数据表分页