mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-29 11:24:10 +01:00
Document the row model and update the data methods to extend this model as the base for aoData
This commit is contained in:
parent
cc265bcb09
commit
d5e5d31725
84
media/js/jquery.dataTables.js
vendored
84
media/js/jquery.dataTables.js
vendored
@ -1173,14 +1173,10 @@
|
||||
|
||||
/* Create the object for storing information about this new row */
|
||||
var iRow = oSettings.aoData.length;
|
||||
var oData = {
|
||||
"nTr": null,
|
||||
var oData = $.extend( true, {}, DataTable.models.oRow, {
|
||||
"_iId": oSettings.iNextId++,
|
||||
"_aData": aDataIn,
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ""
|
||||
};
|
||||
"_aData": aDataIn
|
||||
} );
|
||||
oSettings.aoData.push( oData );
|
||||
|
||||
/* Create the cells */
|
||||
@ -1260,14 +1256,10 @@
|
||||
if ( nTrs[i].nodeName.toUpperCase() == "TR" )
|
||||
{
|
||||
iThisIndex = oSettings.aoData.length;
|
||||
oSettings.aoData.push( {
|
||||
oSettings.aoData.push( $.extend( true, {}, DataTable.models.oRow, {
|
||||
"nTr": nTrs[i],
|
||||
"_iId": oSettings.iNextId++,
|
||||
"_aData": [],
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ''
|
||||
} );
|
||||
"_iId": oSettings.iNextId++
|
||||
} ) );
|
||||
|
||||
oSettings.aiDisplayMaster.push( iThisIndex );
|
||||
nTds = nTrs[i].childNodes;
|
||||
@ -9181,12 +9173,72 @@
|
||||
|
||||
oClasses: null
|
||||
};
|
||||
var modelRow = {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Template object for the way in which DataTables holds information about
|
||||
* each indivudal row. This is the object format used for the settings
|
||||
* aoData array.
|
||||
* @namespace
|
||||
*/
|
||||
DataTable.models.oRow = {
|
||||
/**
|
||||
* TR element for the row
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"nTr": null,
|
||||
|
||||
/**
|
||||
* Redundant - drop
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"_iId": null,
|
||||
"_aData": null,
|
||||
|
||||
/**
|
||||
* Data object from the original data sorce for the row. This is either
|
||||
* an array if using the tranditional form of DataTables, or an object if
|
||||
* using mDataProp options. The exact type will depend on the passed in
|
||||
* data from the data source, or will be an array if using DOM a data
|
||||
* source.
|
||||
* @type array|object
|
||||
* @default []
|
||||
*/
|
||||
"_aData": [],
|
||||
|
||||
/**
|
||||
* Sorting data cache - this array is obstensibily the same length as the
|
||||
* number of columns (although each index is generated only as it is
|
||||
* needed), and holds the data that is used for sorting each column in the
|
||||
* row. We do this cache generation at the start of the sort in order that
|
||||
* the formatting of the sort data need be done only once for each cell
|
||||
* per sort. This array should not be read from or written to by anything
|
||||
* other than the master sorting methods.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"_aSortData": [],
|
||||
|
||||
/**
|
||||
* Array of TD elements that are cached for hidden rows, so they can be
|
||||
* reinserted into the table if a column is made visible again (or to act
|
||||
* as a store if a column is made hidden). Only hidden columns have a
|
||||
* reference in the array. For non-hidden columns the value is either
|
||||
* undefined or null.
|
||||
* @type array nodes
|
||||
* @default []
|
||||
*/
|
||||
"_anHidden": [],
|
||||
|
||||
/**
|
||||
* Cache of the class name that DataTables has applied to the row, so we
|
||||
* can quickly look at this variable rather than needing to do a DOM check
|
||||
* on className for the nTr property.
|
||||
* @type string
|
||||
* @default <i>Empty string</i>
|
||||
*/
|
||||
"_sRowStripe": ""
|
||||
};
|
||||
var modelColumn = {
|
||||
|
@ -21,14 +21,10 @@ function _fnAddData ( oSettings, aDataSupplied )
|
||||
|
||||
/* Create the object for storing information about this new row */
|
||||
var iRow = oSettings.aoData.length;
|
||||
var oData = {
|
||||
"nTr": null,
|
||||
var oData = $.extend( true, {}, DataTable.models.oRow, {
|
||||
"_iId": oSettings.iNextId++,
|
||||
"_aData": aDataIn,
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ""
|
||||
};
|
||||
"_aData": aDataIn
|
||||
} );
|
||||
oSettings.aoData.push( oData );
|
||||
|
||||
/* Create the cells */
|
||||
@ -108,14 +104,10 @@ function _fnGatherData( oSettings )
|
||||
if ( nTrs[i].nodeName.toUpperCase() == "TR" )
|
||||
{
|
||||
iThisIndex = oSettings.aoData.length;
|
||||
oSettings.aoData.push( {
|
||||
oSettings.aoData.push( $.extend( true, {}, DataTable.models.oRow, {
|
||||
"nTr": nTrs[i],
|
||||
"_iId": oSettings.iNextId++,
|
||||
"_aData": [],
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ''
|
||||
} );
|
||||
"_iId": oSettings.iNextId++
|
||||
} ) );
|
||||
|
||||
oSettings.aiDisplayMaster.push( iThisIndex );
|
||||
nTds = nTrs[i].childNodes;
|
||||
|
@ -1,8 +1,68 @@
|
||||
var modelRow = {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Template object for the way in which DataTables holds information about
|
||||
* each indivudal row. This is the object format used for the settings
|
||||
* aoData array.
|
||||
* @namespace
|
||||
*/
|
||||
DataTable.models.oRow = {
|
||||
/**
|
||||
* TR element for the row
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"nTr": null,
|
||||
|
||||
/**
|
||||
* Redundant - drop
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"_iId": null,
|
||||
"_aData": null,
|
||||
|
||||
/**
|
||||
* Data object from the original data sorce for the row. This is either
|
||||
* an array if using the tranditional form of DataTables, or an object if
|
||||
* using mDataProp options. The exact type will depend on the passed in
|
||||
* data from the data source, or will be an array if using DOM a data
|
||||
* source.
|
||||
* @type array|object
|
||||
* @default []
|
||||
*/
|
||||
"_aData": [],
|
||||
|
||||
/**
|
||||
* Sorting data cache - this array is obstensibily the same length as the
|
||||
* number of columns (although each index is generated only as it is
|
||||
* needed), and holds the data that is used for sorting each column in the
|
||||
* row. We do this cache generation at the start of the sort in order that
|
||||
* the formatting of the sort data need be done only once for each cell
|
||||
* per sort. This array should not be read from or written to by anything
|
||||
* other than the master sorting methods.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"_aSortData": [],
|
||||
|
||||
/**
|
||||
* Array of TD elements that are cached for hidden rows, so they can be
|
||||
* reinserted into the table if a column is made visible again (or to act
|
||||
* as a store if a column is made hidden). Only hidden columns have a
|
||||
* reference in the array. For non-hidden columns the value is either
|
||||
* undefined or null.
|
||||
* @type array nodes
|
||||
* @default []
|
||||
*/
|
||||
"_anHidden": [],
|
||||
|
||||
/**
|
||||
* Cache of the class name that DataTables has applied to the row, so we
|
||||
* can quickly look at this variable rather than needing to do a DOM check
|
||||
* on className for the nTr property.
|
||||
* @type string
|
||||
* @default <i>Empty string</i>
|
||||
*/
|
||||
"_sRowStripe": ""
|
||||
};
|
Loading…
Reference in New Issue
Block a user