Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82217

TypeError: b[0].aoData[this[0]] is undefined

$
0
0

Hi there, I am getting the above error message.

When the user selects a record from my first datatable it invokes the following function to load data into my second data table:

HTML

<div id="tt_block" style = "margin-top: 30px;" class="table-responsive">
    <table id="tooltip_datatable" class="table table-hover">
        <thead>
            <tr>
                <th></th>
                <th>ID</th>
                <th>Keyword</th>
                <th>Tooltip</th>
                <th></th>
            </tr>
        </thead>
    </table>
</div>

JQuery

function populateTooltipDT(contentID) {

        $table = $('#tooltip_datatable').DataTable ( {
            select: {
                style: 'single'
            },
            destroy: true,
            ajax: {
                url: '../workflow_ajax/tooltips/ajax.php',
                type: 'POST',
                data: {contentID: contentID},
                dataType: 'json',
                dataFilter: function(data){
                    // DataFilter is where you can change the json data format from what your server sends to
                    // what DataTable expects.
                    // if your data is serialized at this point, deserialize it
                    var jData = JSON.parse(data);

                    // then what the DataTables expect and reserialize
                    var dtData =JSON.stringify( {"data": jData});
                    console.log(dtData);
                    return dtData;
                }
            },
            "bFilter": false, // remove search filter
            "order": [],
            responsive: true,
            columns:    [
                            { 'data': null },
                            { 'data': 'id' },
                            { 'data': 'keyword' },
                            { 'data': 'tip' },
                            { 'data': null }
                        ],
            "columnDefs":   [
                                {
                                    "targets": -5,
                                    "orderable": false,
                                    "data": null,
                                    "defaultContent": "<button type = 'button' class='btn btn-xs btn-warning'>Edit</button>"
                                },
                                {
                                    "targets": [4],
                                    "orderable": false,
                                    "data": null,
                                    "defaultContent": "<button type = 'button' class='btn btn-xs btn-danger'>Delete</button>"
                                },
                                {
                                    "targets": [ 1 ],
                                    "visible": false,
                                    "searchable": false
                                }
                            ]
        });

    }

The first time the user selects a record from the first data table the second datatable is loaded correctly. But when the user selects a different record, the second datatable does not change and when I check the console i am getting the above error message but no idea why. Please can you help.

Thanks


Viewing all articles
Browse latest Browse all 82217

Trending Articles