1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-19 17:54:14 +01:00

Dev: JSON API - store and return the original JSON object

- Rather than creating a new JSON object from the XHR, use the one that
  was returned by the server. This is useful if you manipulate the data
  since you want to just keep using the same object.
This commit is contained in:
Allan Jardine 2013-09-23 11:45:23 +01:00
parent 7c1d27ae5f
commit 76ae8661c8
2 changed files with 10 additions and 6 deletions

View File

@ -1 +1 @@
2710768e040c77ffa125c63d4951de6620686cc0
5de16aa6aa98d24b5c0ac5902f5fe994f905d434

View File

@ -1953,6 +1953,7 @@
oSettings.oApi._fnLog( oSettings, 0, json.sError );
}
oSettings.json = json;
$(instance).trigger('xhr', [oSettings, json]);
fn( json );
},
@ -6869,11 +6870,7 @@
var ctx = this.context;
if ( ctx.length > 0 ) {
var xhr = ctx[0].jqXHR;
if ( xhr ) {
return $.parseJSON( xhr.responseText );
}
return this.context.json;
}
// else return undefined;
@ -12548,6 +12545,13 @@
*/
"jqXHR": null,
/**
* JSON returned from the server in the last Ajax request
* @type object
* @default undefined
*/
"json": undefined,
/**
* Function to get the server-side data.
* Note that this parameter will be set by the initialisation routine. To