jquery datatables column.data undefined

jquery datatables column.data undefined

kasimbkasimb Posts: 4Questions: 2Answers: 1

I am using row grouping feature of datatable, here is my drawcallback function:

oTable = jQuery_1_11('#example').dataTable({
"searching": false,
"processing": true,
"serverSide": true,
"iDisplayLength": 20,
"sPaginationType": "full_numbers",
"language": {"infoFiltered": ""},
columnDefs: [{
        targets: 0,
        "visible": false,
    }],
"ajax": {
    "url": "index.php?entryPoint=getTableData",
    "dataType": 'json',
    "pages": "5",
    "type": "POST",
    "data": function(d) {
        d.dbJson = sendJson
    },
    "dataSrc": function(response) {
        return response.aaData;

    }
},
"drawCallback": function(  ) {

    var api = this.api();
    var rows = api.rows({page: 'current'}).nodes();
    var last = null;
    api.column(0, {page: 'current'}).data().each(function(group, i) {
        if (last !== group) {
            jQuery_1_11(rows).eq(i).before(
                    '<tr class="group"><td colspan="5">' + group + '</td></tr>'
                    );
            last = group;
        }
    });
}

})

I don't know it's stuck on.

api.column(0, {page: 'current'}).data().each(function(group, i) {

This is giving the error:
Uncaught TypeError: Cannot read property 'each' of undefined

Please help!

This question has an accepted answers - jump to answer

Answers

  • kasimbkasimb Posts: 4Questions: 2Answers: 1
    edited April 2015 Answer ✓

    This worked by changing to latest version of DataTables 1.10.6.
    Previously i was using DataTables 1.10.6-dev

    And by changing

    jQuery_1_11('#example').dataTable
    to

    jQuery_1_11('#example').DataTable

  • kasimbkasimb Posts: 4Questions: 2Answers: 1
    edited April 2015

    something has gone wrong, the grouping doesn't work properly if any column other than 0 is used . it doesn't group properly if column number 1 is used for grouping

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Please link to a test case showing the issue.

    Allan

  • daphnesmitdaphnesmit Posts: 1Questions: 0Answers: 0

    I also have this problem. using the latest version of npm datatables

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    As per my previous message in this thread, and you link to a test case showing the issue.

    Allan

This discussion has been closed.