Using Array of object when loading from javascript array and not ajax
Using Array of object when loading from javascript array and not ajax
I am trying to basically combine these two examples and load an array of objects directly into aaData from a variable. Not an Ajax source.
http://www.datatables.net/release-datatables/examples/data_sources/js_array.html
http://www.datatables.net/release-datatables/examples/ajax/objects.html
trying to set sAjaxSource to variable http://live.datatables.net/utecax/edit#
trying to set aaData to variable http://live.datatables.net/iyavud/5/edit
http://www.datatables.net/release-datatables/examples/data_sources/js_array.html
http://www.datatables.net/release-datatables/examples/ajax/objects.html
trying to set sAjaxSource to variable http://live.datatables.net/utecax/edit#
trying to set aaData to variable http://live.datatables.net/iyavud/5/edit
This discussion has been closed.
Replies
See also: http://datatables.net/blog/Extended_data_source_options_with_DataTables and the Ajax example you linked to :-)
Allan
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var iMin = document.getElementById('start-datepicker').value;
var iMax = document.getElementById('end-datepicker').value;
// Create Minimum Date Object
var iMinDate = new Date(iMin);
// Create Maximum Date Object
var iMaxDate = new Date(iMax);
// Create Date Column Object
var iDateStr = aData.date;
var iDate = new Date(iDateStr);
if ( iMinDate < iDate && iDate < iMaxDate )
{
return true;
}
return false;
}
);
[/code]
[code]
var bTest = afnFilters[i](
oSettings,
_fnGetRowData( oSettings, iDisIndex, 'filter', aiFilterColumns ),
iDisIndex
);
[/code]
It is creating an array from the current data, which I think is wrong. I've flagged this post to have this fixed as part of the 1.10 development. It should either pass in the original data source (which will be much faster), or pass in the original data source as a new parameter - which will be more compatible. I'll have a think about it!
Allan