fnServerData,bServerSide and sAjaxDataProp
fnServerData,bServerSide and sAjaxDataProp
pboisso
Posts: 7Questions: 0Answers: 0
Hi there,
I'm trying to use fnServerData to get around the cross-site scripting stuff, but dataTables is staying in 'processing' mode forever when I add it. FYI, bServerSide is set to false and sAjaxDataProp is set to empty. I can see that the API is being called properly, data is retrieved and fnCallback is even called, but there is something I am missing... Any help would be appreciated.
[code]
$('#table_sites').dataTable( {
"sDom": "<'row-fluid'<'span4'l><'span4'T><'span4'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"bProcessing": true,
"sAjaxSource": 'http://mysite/api/site/list',
"sAjaxDataProp": "",
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
$(nRow).attr('id',aData["_id"]) //need this because server side data does not include DT_RowId
},
"fnServerData": function( sUrl, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "jsonp",
"cache": false
} );
}
} );
[/code]
returned from server :
[code]
[{"_id":"ID:50d214c23b8e77804000000d","name":"patati142","type":"general","version":"1.0","theme":"valencia-dark","created":1355945154,"modified":1355945154,"lang":"en-CA"},{"_id":"ID:50d214b83b8e77ac4100000a","name":"patati16","type":"general","version":"1.0","theme":"valencia-gray-black","created":1355945144,"modified":1355945144,"lang":"en-CA"},{"_id":"ID:50d212e73b8e77824000000c","name":"patati14","type":"general","version":"1.0","theme":"client-eiffelv2","created":1355944678,"modified":1355944704,"lang":"en-CA"},{"_id":"ID:50d2123e3b8e774b40000006","name":"patati13","type":"general","version":"1.0","theme":"client-ambassadeur","created":1355944509,"modified":1355944517,"lang":"fr-CA"},{"_id":"ID:50d2120d3b8e777e40000009","name":"patati12","type":"general","version":"1.0","theme":"client-createursaveurs","created":1355944460,"modified":1355944508,"lang":"fr-CA"}]
[/code]
I'm trying to use fnServerData to get around the cross-site scripting stuff, but dataTables is staying in 'processing' mode forever when I add it. FYI, bServerSide is set to false and sAjaxDataProp is set to empty. I can see that the API is being called properly, data is retrieved and fnCallback is even called, but there is something I am missing... Any help would be appreciated.
[code]
$('#table_sites').dataTable( {
"sDom": "<'row-fluid'<'span4'l><'span4'T><'span4'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"bProcessing": true,
"sAjaxSource": 'http://mysite/api/site/list',
"sAjaxDataProp": "",
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
$(nRow).attr('id',aData["_id"]) //need this because server side data does not include DT_RowId
},
"fnServerData": function( sUrl, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "jsonp",
"cache": false
} );
}
} );
[/code]
returned from server :
[code]
[{"_id":"ID:50d214c23b8e77804000000d","name":"patati142","type":"general","version":"1.0","theme":"valencia-dark","created":1355945154,"modified":1355945154,"lang":"en-CA"},{"_id":"ID:50d214b83b8e77ac4100000a","name":"patati16","type":"general","version":"1.0","theme":"valencia-gray-black","created":1355945144,"modified":1355945144,"lang":"en-CA"},{"_id":"ID:50d212e73b8e77824000000c","name":"patati14","type":"general","version":"1.0","theme":"client-eiffelv2","created":1355944678,"modified":1355944704,"lang":"en-CA"},{"_id":"ID:50d2123e3b8e774b40000006","name":"patati13","type":"general","version":"1.0","theme":"client-ambassadeur","created":1355944509,"modified":1355944517,"lang":"fr-CA"},{"_id":"ID:50d2120d3b8e777e40000009","name":"patati12","type":"general","version":"1.0","theme":"client-createursaveurs","created":1355944460,"modified":1355944508,"lang":"fr-CA"}]
[/code]
This discussion has been closed.
Replies
parsererror
Error
arguments: undefined
get stack: function () { [native code] }
message: "jQuery18206131650593597442_1356014750662 was not called"
set stack: function () { [native code] }
type: undefined
__proto__: d
Allan