mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
New: Default Ajax source property updated to be data
- In keeping with the camelCase name changes for DataTables 1.10, the default Ajax data source object property name has been updated from `aaData` to just `data`. Note that this is a fulyl backwards compatible change - if aaData is present in the data, it will be used.
This commit is contained in:
parent
fe1a5a630a
commit
3795134856
@ -1 +1 @@
|
|||||||
f11c3ae860dfc41e4a4d9eda1d8af7aa7f5886d3
|
9fd084bdae8fa642638c88f15592e3322548c328
|
||||||
|
45
media/js/jquery.dataTables.js
vendored
45
media/js/jquery.dataTables.js
vendored
@ -2165,11 +2165,16 @@
|
|||||||
*/
|
*/
|
||||||
function _fnAjaxDataSrc ( oSettings, json )
|
function _fnAjaxDataSrc ( oSettings, json )
|
||||||
{
|
{
|
||||||
// @todo data and callback to aaData
|
|
||||||
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
|
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
|
||||||
oSettings.ajax.dataSrc :
|
oSettings.ajax.dataSrc :
|
||||||
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
|
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
|
||||||
|
|
||||||
|
// Compatibility with 1.9-. In order to read from aaData, check if the
|
||||||
|
// default has been changed, if not, check for aaData
|
||||||
|
if ( dataSrc === 'data' ) {
|
||||||
|
return json.aaData || json[dataSrc];
|
||||||
|
}
|
||||||
|
|
||||||
return dataSrc !== "" ?
|
return dataSrc !== "" ?
|
||||||
_fnGetObjectDataFn( dataSrc )( json ) :
|
_fnGetObjectDataFn( dataSrc )( json ) :
|
||||||
json;
|
json;
|
||||||
@ -9023,15 +9028,16 @@
|
|||||||
* not return anything from the function. This supersedes `fnServerParams`
|
* not return anything from the function. This supersedes `fnServerParams`
|
||||||
* from DataTables 1.9-.
|
* from DataTables 1.9-.
|
||||||
*
|
*
|
||||||
* * `dataSrc` - By default DataTables will look for the property 'aaData'
|
* * `dataSrc` - By default DataTables will look for the property `data` (or
|
||||||
* when obtaining data from an Ajax source or for server-side processing -
|
* `aaData` for compatibility with DataTables 1.9-) when obtaining data
|
||||||
* this parameter allows that property to be changed. You can use
|
* from an Ajax source or for server-side processing - this parameter
|
||||||
* Javascript dotted object notation to get a data source for multiple
|
* allows that property to be changed. You can use Javascript dotted
|
||||||
* levels of nesting, or it my be used as a function. As a function it
|
* object notation to get a data source for multiple levels of nesting, or
|
||||||
* takes a single parameter, the JSON returned from the server, which can
|
* it my be used as a function. As a function it takes a single parameter,
|
||||||
* be manipulated as required, with the returned value being that used by
|
* the JSON returned from the server, which can be manipulated as
|
||||||
* DataTables as the data source for the table. This supersedes
|
* required, with the returned value being that used by DataTables as the
|
||||||
* `sAjaxDataProp` from DataTables 1.9-.
|
* data source for the table. This supersedes `sAjaxDataProp` from
|
||||||
|
* DataTables 1.9-.
|
||||||
*
|
*
|
||||||
* * `success` - Should not be overridden it is used internally in
|
* * `success` - Should not be overridden it is used internally in
|
||||||
* DataTables. To manipulate / transform the data returned by the server
|
* DataTables. To manipulate / transform the data returned by the server
|
||||||
@ -9065,14 +9071,14 @@
|
|||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Get JSON data from a file via Ajax.
|
* // Get JSON data from a file via Ajax.
|
||||||
* // Note DataTables expects data in the form `{ aaData: [ ...data... ] }` by default).
|
* // Note DataTables expects data in the form `{ data: [ ...data... ] }` by default).
|
||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "ajax": "data.json"
|
* "ajax": "data.json"
|
||||||
* } );
|
* } );
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // Get JSON data from a file via Ajax, using `dataSrc` to change
|
* // Get JSON data from a file via Ajax, using `dataSrc` to change
|
||||||
* // `aaData` to `tableData` (i.e. `{ aaData: [ ...data... ] }`)
|
* // `data` to `tableData` (i.e. `{ tableData: [ ...data... ] }`)
|
||||||
* $('#example').dataTable( {
|
* $('#example').dataTable( {
|
||||||
* "ajax": {
|
* "ajax": {
|
||||||
* "url": "data.json",
|
* "url": "data.json",
|
||||||
@ -10824,12 +10830,13 @@
|
|||||||
* __Deprecated__ The functionality provided by this parameter has now been
|
* __Deprecated__ The functionality provided by this parameter has now been
|
||||||
* superseded by that provided through `ajax`, which should be used instead.
|
* superseded by that provided through `ajax`, which should be used instead.
|
||||||
*
|
*
|
||||||
* By default DataTables will look for the property 'aaData' when obtaining
|
* By default DataTables will look for the property `data` (or `aaData` for
|
||||||
* data from an Ajax source or for server-side processing - this parameter
|
* compatibility with DataTables 1.9-) when obtaining data from an Ajax
|
||||||
* allows that property to be changed. You can use Javascript dotted object
|
* source or for server-side processing - this parameter allows that
|
||||||
* notation to get a data source for multiple levels of nesting.
|
* property to be changed. You can use Javascript dotted object notation to
|
||||||
|
* get a data source for multiple levels of nesting.
|
||||||
* @type string
|
* @type string
|
||||||
* @default aaData
|
* @default data
|
||||||
*
|
*
|
||||||
* @dtopt Options
|
* @dtopt Options
|
||||||
* @dtopt Server-side
|
* @dtopt Server-side
|
||||||
@ -10837,7 +10844,7 @@
|
|||||||
*
|
*
|
||||||
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
||||||
*/
|
*/
|
||||||
"sAjaxDataProp": "aaData",
|
"sAjaxDataProp": "data",
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10847,8 +10854,6 @@
|
|||||||
* You can instruct DataTables to load data from an external
|
* You can instruct DataTables to load data from an external
|
||||||
* source using this parameter (use aData if you want to pass data in you
|
* source using this parameter (use aData if you want to pass data in you
|
||||||
* already have). Simply provide a url a JSON object can be obtained from.
|
* already have). Simply provide a url a JSON object can be obtained from.
|
||||||
* This object must include the parameter `aaData` which is the data source
|
|
||||||
* for the table.
|
|
||||||
* @type string
|
* @type string
|
||||||
* @default null
|
* @default null
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user