-
-
Save srkama/9b7d26a1923fd0f4da00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#participantes-table').dataTable({ | |
bProcessing: true, | |
bServerSIde: true, | |
sAjaxSource: "/path/to/your/tastypie/api/list/objects/?format=json", | |
sAjaxDataProp: "objects", | |
aoColumns: [ | |
// Put the resource name that corresponds to each table column | |
{'mData': "your"}, | |
{'mData': "columns"}, | |
], | |
fnServerData: function(source, oaData, callback, settings) { | |
settings.jqXHR = $.get( | |
source, | |
function(data){ | |
// Magic happens here! tastypie provides the data but | |
// stupid dataTables requires it to have stupid names | |
data.echo = oaData.echo; | |
data.iTotalRecords = data.meta.total_count; | |
data.iTotalisplayRecords = data.meta.limit; | |
console.debug(data); | |
console.debug(callback); | |
callback(data); | |
}, | |
'json') | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment