I am struggling with grasping jQuery datatables (v1.10.1 via CDN), and the conventions used in the current version. Various documentation is confusing/lacking in 'complete' examples at best, conflicting at worst.
Please explain the current (v1.10.1) best practices with regards to defining the contents of a field. I see lots of information about columns/mData/mRender/mDataProp, amongst others and I feel overloaded as to what each one means and/or when each should be used (see the 'research' section below for examples).
Secondly, where do I stand with regards to using dates and "set"/"display"/"filter"/"sort" (assuming that this is the route to take, with mData/mRender)?
Example
EDIT: Here's an example of some data in a fiddle:
var massData = [
{ "Column1": "test1", "Timestamp": "Sun Jul 27 2014 14:42:20 GMT+0100 (GMT Standard Time)", "Date": "18/10/2012" },
{ "Column1": "test2", "Timestamp": "Mon Jul 28 2014 14:42:20 GMT+0100 (GMT Standard Time)", "Date": "18/10/2016" },
{ "Column1": "test3", "Timestamp": "Wed Jul 22 2014 14:42:20 GMT+0100 (GMT Standard Time)", "Date": "18/01/2012" }
];
var keys = ["Column1", "Timestamp", "Date"];
var columns = [];
for (var keyIndex = 0; keyIndex < keys.length; keyIndex++) {
columns.push({
"title": keys[keyIndex],
"data": keys[keyIndex],
"defaultContent": ""
});
}
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
$('#example').dataTable({
"data": massData,
"deferRender": true,
"scrollY": 400,
"scrollX": true,
"columns": columns
});
Research
I see this question which has code using mRender, though my understanding is that filtering/sorting will use the actual data
I see this example and this documentation which uses aoColumnDefs, aTargets and mData..?
This question has a reply to "Filtering using the rendered text", but uses aoColumnDefs, mDataProp, and a 'renderDate()' function, but does NOT make use of mRender
The documentation for mRender and mData suggests that mRender depends upon mData..
Other documentation suggests fnRender/bUseRendered is deprecated