Datatable responsive row collapse problem

Datatable responsive row collapse problem

jemzjemz Posts: 131Questions: 40Answers: 1
edited August 2015 in Free community support

Hi, I am using Datatables responsive it works fine when the rows will not collapse.but when it collapse and clicking the "plus green icon" to show the child row. I cannot get anymore the row id.

`

   $('#mytable').on( 'click', 'tr', function (e) {
        var rowid = tbl.row( this ).data().id; // it will udefined when the rows collapase

    }

`

Thank you in advance.

Answers

  • NatmcNatmc Posts: 1Questions: 0Answers: 0
    edited November 2015

    Hi, I'm having the same trouble.
    When I try to get the row data with the row expanded, it throws me a error "undefined".
    Someone find something?

  • danpaduadanpadua Posts: 1Questions: 0Answers: 0

    I have a solution, at least it worked for me. When the DataTables is collapsed there css classes that apply when the lines open. One solution is to verify that the selected line is open or not. If you are then I attribute the nRow variable and use. Example:

            DataTablesNet.prototype.editRow = function (table, nRow) {
                  //Here check if the line is open
                  if ($("#tableId").find(".parent").length > 0)
                      nRow = $("#tableId").find(".parent");
    
                  var model = table.row(nRow).data();
                  ...
            }
    
This discussion has been closed.