【问题标题】:How to get all ID's of all Checked data in all pages on Datatables如何在数据表的所有页面中获取所有已检查数据的所有 ID
【发布时间】:2022-01-12 01:22:16
【问题描述】:

您好,我的数据表在第一列带有复选框 我能够获取选中的复选框 ID,但我无法获取其他页面上的所有数据

我有这个来呈现我的数据表

 var tableDelcar;
    function LoadTableDelcar() {



        tableDelcar = $('#tblDelcar').DataTable({
            //dom: 'Brtip',

            order: [[1, 'asc']],
            buttons: [
            'csv', 'excel', 'pdf', 'print'
            ],
            pageLength: 10,
            "ajax": {
                async: false,
                type: 'POST',
                contentType: 'application/json',
                url: 'MaintenancePage.aspx/getCarDelMaintable',
                "dataSrc": "d",
                dataType: 'json',
            },
            "columns": [
          {
              "d": null,
              render: function (data, type, row, meta) {

                  return '<input type="checkbox" class="select" id="' + row.CAR_NO + '"></td>';
              }, title: "Action"
          },
        { "data": "CAR_NO", title: "Car No" },
        { "data": "FINDINGS", title: "FINDINGS" },
        { "data": "ActionOwner", title: "Action Owner" },
        { "data": "Auditor", title: "Status" },
        { "data": "COORDINATOR", title: "COORDINATOR" }

   
            ]
        });


    }

这是我获取选中复选框的 ID 的功能

  function DeleteCar() {
    

       var IDs = $("#tblDelcar input:checkbox:checked").map(function () {
            return $(this).attr("id");
        }).get(); alert(IDs);
}

【问题讨论】:

    标签: javascript jquery datatables datatables-1.10


    【解决方案1】:

    确保当您在其他页面中调用您的函数时,您的 DOM 已加载。 你有错误吗?

    【讨论】:

      猜你喜欢
      • 2019-05-15
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      • 2022-08-14
      • 2012-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多