Detail drawcallback not working after redraw table

Detail drawcallback not working after redraw table

rayhanyulandarayhanyulanda Posts: 1Questions: 1Answers: 0

Description of problem: I tried using drawCallback for show detail of the row, it works for the first page but after draw the datatable i can't click the detail anymore. Here is it code of drawCallback.

function () {
                              function format ( d ) {
                                return d.handleBarColumn;
                              }
                              let table = $("#dataTable").DataTable();
                              $("#dataTable tbody").on("click", "td.details-control", function () {
                              let tr = $(this).closest("tr");
                              let row = table.row( tr );
                              if ( row.child.isShown() ) {
                                row.child.hide();
                                tr.removeClass("shown");
                              }
                              else {
                                row.child(format(row.data())).show();
                                tr.addClass("shown");
                              }
                            });
                            }

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.