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

individual column filtering meets AJAX source!

$
0
0
Hi,

I am trying to get the individual column filtering (select) example working with an AJAX source.

The table displays perfectly but at this point, unfortunately, all my drop downs are empty.

My code is as follow:

$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'json.txt',
"aoColumns": [
{ "mData": "id_region" },
{ "mData": "region_name" },
{ "mData": "division" }
]
} );

$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect(oTable.fnGetColumnData(i));
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
} );

apparently, oTable.fnGetColumnData returns an empty array because aiRows.length is always 0. I just don't understand why!

Am I doing something wrong?

Viewing all articles
Browse latest Browse all 1816

Trending Articles