Bhu*_*hah 4 javascript php checkbox datatable jquery
我正在使用 jquery 数据表列出我的内容,其中具有复选框选择和选定的内容发布数据,但在提交的表单中仅发送当前页面数据。
我的数据表代码是:
$('#select').dataTable( {
"order": [[ 2, "desc" ]],
"lengthMenu": [[50, -1], [50, "All"]],
"columnDefs": [
{ orderable: false, targets: [0, 1, 3, 5] },
{ "width": "20px", "targets": [0, 1] },
{ "width": "80px", "targets": [5] }
],
});
Run Code Online (Sandbox Code Playgroud)
当我单击提交时,它仅提交当前页面值的复选框数组。
我已经引用了此链接带有选定复选框的分页。复选框仅适用于当前分页页面。jQuery 数据表,但那里提供的解决方案与链接和链接不起作用。
小智 6
您可以使用以下代码获取所有选定的复选框值,这可能对您有帮助
var myArray = [];
var id = "";
var oTable = $("#example").dataTable();
$(".class1:checked", oTable.fnGetNodes()).each(function() {
if (id != "") {
id = id + "," + $(this).val();
} else {
id = $(this).val();
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9321 次 |
| 最近记录: |