DOM sourced dataTable: draw() fails

DOM sourced dataTable: draw() fails

Denis.David@dqs.deDenis.David@dqs.de Posts: 28Questions: 8Answers: 1
edited August 2015 in DataTables 1.10

Using a DOM sourced dataTable I get an error message while redrawing the table after inserting a new row:

Uncaught TypeError: Cannot read property 'length' of undefined

Through debugging I made sure the row inserting works well, the error occurs while performing the draw() method.

Thanks for guiding me on the right track.

JS (table initialization):

var t = $('#xyz').DataTable({
        "scrollCollapse": true,
        "paging": false,
        "searching": false,
        "info": false,
        "rowId": "col1",
        "columns": [
            { data: "col1" },
            { data: "col2" },
            { data: "col3" },
            { data: "col4" },
            { data: "col5" },
            { data: "col6" },
            { data: "col7" }],

        "dom": "Bfrtip",
        "aaSortingFixed": [
            [0, 'asc']
        ],
        "bServerSide": false,
        "select": true
    });
    
    t.rows.add([{"col1": "12345", "col2": 99, "col3": "X", "col4": "X", "col5": "X", "col6": "X", "col7": "X"}]).draw();

HTML:

<table id="xyz" class="display" style="width: 100%;" cellspacing="0">
<thead>
    <tr>
    <th>col1</th>
    <th>col2</th>
    <th>col3</th>
    <th>col4</th>
    <th>col5</th>
    <th>col6</th>
    <th>col7</th>
    </tr>
</thead>
<tbody></tbody>
</table>

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    This is a bug in Select 1.0.0. Could you try it with the nightly which has resolved this issue please. 1.0.1 will be released soon with the fix.

    Allan

  • Denis.David@dqs.deDenis.David@dqs.de Posts: 28Questions: 8Answers: 1

    Thank you so much, Allan. You saved my day :)

    Denis

This discussion has been closed.