JSON Returning with tn/4 error

JSON Returning with tn/4 error

tvarcortvarcor Posts: 1Questions: 1Answers: 0
edited February 2016 in Free community support

Hello,

I Have a json return from PHP and an AJAX Request to get that json. I have followed http://datatables.net/examples/ajax/objects.html exactly and I am getting the error "DataTables warning: table id=tblTableList - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4" - I am stumped. I added the columns option and I received the same error. Please Help. It shows blank rows. It shows the correct number of rows

My JS:

$(function() {
    var tblTableList = $("#tblTableList");

   tblTableList.DataTable({
        scrollY: '82vh',
        scrollCollapse: true,
        paging: false,
        "ajax": "?a=tbl_list&db=w9IMh235FX",
        "dom": "<'row'<'col-sm-2'f><'col-sm-8''&nbsp;'><'col-sm-2 text-right'i>>" + "<'row'<'col-sm-12'tr>>",
        "aoColumns": [
            null, {"bSearchable": false}, {"bSearchable": false},
        ],
        "aoColumnDefs": [{
            'bSortable': false,
            'aTargets': [1]
        }],
        "oLanguage": {
            "sSearch": "Search Tables:",
            "sInfo": "_TOTAL_ Tables in Database",
             "zeroRecords": "No Tables Found",
            "infoEmpty": "No Tables available",
        }
    });
});

My JSON:

{"data":[{"tbl_name":"Users","actions":"Future","row_count":"0"},{"tbl_name":"tokens","actions":"Future","row_count":"0"}]}

My HTML:

 <table id='tblTableList' class="table table-striped table-bordered table-large top_padding_datatable scrolly" >
            <thead>
                <tr>
                    <th><i class="fa fa-table fa-fw"></i> Table</th>
                    <th><i class="fa fa-exchange fa-fw"></i> Actions</th>
                    <th class="hidden-xs"><i class="fa fa-align-justify fa-fw"></i> Row Count</th>
                </tr>
            </thead>
             <tfoot>
                <tr>
                    <th><i class="fa fa-table fa-fw"></i> Table</th>
                    <th><i class="fa fa-exchange fa-fw"></i> Actions</th>
                    <th class="hidden-xs"><i class="fa fa-align-justify fa-fw"></i> Row Count</th>
                </tr>
            </tfoot>
        </table>

Answers

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    You are using objects for the data, but haven't told DataTables which object property to use for each column. See the data documentation for how to do that with columns.data.

    Allan

This discussion has been closed.