Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 124

AJAX data source throwing TypeError: b[a] is undefined

$
0
0

(debug code ucolef )

I'm trying to get my tables working with an AJAX source (client-side processing). The table definition looks like this:

var bbTable = $('#bb_datatable').DataTable({

            "sDom": "<'row  bottom-buffer10' <'.col-sm-4'><'.col-sm-4'> <'.col-sm-4 pull-right' f>>t<'row'<'.col-sm-8'i r><'pull-right'>S>",
            "columns" : [
                {
                    'data': 'field_id_59',
                    'bVisible' : true
                },
                {
                    'data': 'field_id_60',
                    'bVisible' : true
                }
            ],
            "scrollY": "600px",
            "scrollCollapse": true,
            "paginate": false,
            "order" : [],
            "select": "single",
            "buttons": [],
            "ajax": {
                "url": bb.ajaxPath,
                "data": function ( d ) {
                    return $.extend( {}, d, {
                        "action": "fill-datatable",
                        "query_id": 28,
                        "col_prop_name_array": ['field_id_59', 'field_id_60']
                    } );
                }
            }
        }
    );

The AJAX call returns something that looks identical to the analogous examples on this site:

{
    "data": [{
        "field_id_59": "1",
        "field_id_60": "BigBench Adminx"
    }, {
        "field_id_59": "2",
        "field_id_60": "BigBench Mouse "
    }]
}

...and datatables then throws the above error.

If, instead of "ajax: ", I specify the following, no error is generated:

"data": [{"field_id_59":"1","field_id_60":"Big Bench Adminx"},{"field_id_59":"2","field_id_60":"Big Bench Mouse"}],

Comparison of this problem to some previous posts in this forum suggests that Datatables doesn't like the JSON that is being returned. I know that I used to specify iTotalRecords and iTotalDisplayRecords in the JSON object that was returned but this seems to have been deprecated in 1.9x for client side processing?

Thanks in advance,

Rob


Viewing all articles
Browse latest Browse all 124

Trending Articles