mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Updated: Nearly all callbacks now use an array and fire an event using the use DataTables standard method for dealing with callbacks. row, header, footer, init and pre-draw callback have been added to this new method. Only aoStateSave does not use method yet. fnCookieCallback and fnInfoCallback will not use the new methods.
Update: fnRowCallback - no need to return the TR element - it was a fairly pointless thing to do - if you want to replace the element then you need to do it with fnDrawCallback
This commit is contained in:
parent
d18b68d067
commit
8c9f0b61e8
@ -20,7 +20,6 @@
|
||||
{
|
||||
$('td:eq(4)', nRow).html( '<b>A</b>' );
|
||||
}
|
||||
return nRow;
|
||||
},
|
||||
"aoColumnDefs": [ {
|
||||
"sClass": "center",
|
||||
@ -37,7 +36,7 @@
|
||||
</div>
|
||||
|
||||
<h1>Preamble</h1>
|
||||
<p>The following example shows how a callback function can be used to format a particular row at draw time. For each row that is generated for display, the <b>fnRowCallback()</b> function is called. It is passed the row node which can then be modified and returned. In this case a trivial example of making the 'grade' column bold if the grade is 'A' is shown (note that this could also be performed using the <b>fnRender()</b> function, but this is just for example).</p>
|
||||
<p>The following example shows how a callback function can be used to format a particular row at draw time. For each row that is generated for display, the <b>fnRowCallback()</b> function is called. It is passed the row node which can then be modified. In this case a trivial example of making the 'grade' column bold if the grade is 'A' is shown (note that this could also be performed using the <b>fnRender()</b> function, but this is just for example).</p>
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="demo">
|
||||
@ -479,7 +478,6 @@
|
||||
{
|
||||
$('td:eq(4)', nRow).html( '<b>A</b>' );
|
||||
}
|
||||
return nRow;
|
||||
},
|
||||
"aoColumnDefs": [ {
|
||||
"sClass": "center",
|
||||
|
@ -24,7 +24,6 @@ $(document).ready(function() {
|
||||
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
||||
$(nRow).addClass('row_selected');
|
||||
}
|
||||
return nRow;
|
||||
}
|
||||
});
|
||||
|
||||
@ -97,7 +96,6 @@ $(document).ready(function() {
|
||||
if ( jQuery.inArray(aData.DT_RowId, aSelected) !== -1 ) {
|
||||
$(nRow).addClass('row_selected');
|
||||
}
|
||||
return nRow;
|
||||
}
|
||||
});
|
||||
|
||||
|
163
media/js/jquery.dataTables.js
vendored
163
media/js/jquery.dataTables.js
vendored
@ -1273,15 +1273,14 @@
|
||||
var i, iLen;
|
||||
var anRows = [];
|
||||
var iRowCount = 0;
|
||||
var bRowError = false;
|
||||
var iStripes = oSettings.asStripeClasses.length;
|
||||
var iOpenRows = oSettings.aoOpenRows.length;
|
||||
|
||||
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
||||
if ( oSettings.fnPreDrawCallback !== null &&
|
||||
oSettings.fnPreDrawCallback.call( oSettings.oInstance, oSettings ) === false )
|
||||
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
|
||||
if ( $.inArray( false, aPreDraw ) !== -1 )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
oSettings.bDrawing = true;
|
||||
@ -1349,17 +1348,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom row callback function - might want to manipule the row */
|
||||
if ( oSettings.fnRowCallback )
|
||||
{
|
||||
nRow = oSettings.fnRowCallback.call( oSettings.oInstance, nRow,
|
||||
oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j );
|
||||
if ( !nRow && !bRowError )
|
||||
{
|
||||
_fnLog( oSettings, 0, "A node was not returned by fnRowCallback" );
|
||||
bRowError = true;
|
||||
}
|
||||
}
|
||||
/* Row callback functions - might want to manipule the row */
|
||||
_fnCallbackFire( oSettings, 'aoRowCallback', 'row',
|
||||
[nRow, oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j] );
|
||||
|
||||
anRows.push( nRow );
|
||||
iRowCount++;
|
||||
@ -1407,20 +1398,12 @@
|
||||
anRows[ iRowCount ].appendChild( nTd );
|
||||
}
|
||||
|
||||
/* Callback the header and footer custom funcation if there is one */
|
||||
if ( oSettings.fnHeaderCallback )
|
||||
{
|
||||
oSettings.fnHeaderCallback.call( oSettings.oInstance, $(oSettings.nTHead).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(),
|
||||
oSettings.aiDisplay );
|
||||
}
|
||||
/* Header and footer callbacks */
|
||||
_fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
|
||||
|
||||
if ( oSettings.fnFooterCallback )
|
||||
{
|
||||
oSettings.fnFooterCallback.call( oSettings.oInstance, $(oSettings.nTFoot).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(),
|
||||
oSettings.aiDisplay );
|
||||
}
|
||||
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
|
||||
|
||||
/*
|
||||
* Need to remove any old row from the display - note we can't just empty the tbody using
|
||||
@ -2576,10 +2559,7 @@
|
||||
function _fnInitComplete ( oSettings, json )
|
||||
{
|
||||
oSettings._bInitComplete = true;
|
||||
if ( oSettings.fnInitComplete )
|
||||
{
|
||||
oSettings.fnInitComplete.call( oSettings.oInstance, oSettings, json );
|
||||
}
|
||||
_fnCallbackFire( oSettings, 'aoInitComplete', 'init', [oSettings, json] );
|
||||
}
|
||||
|
||||
|
||||
@ -4247,6 +4227,11 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* xxx - This is horrible! What we really want to do is use a proper object and
|
||||
* pass that around - but jQuery doesn't have a toJson option. Either need to use
|
||||
* $.param or JSON.stringify or something else
|
||||
*/
|
||||
|
||||
/* Store the interesting variables */
|
||||
var i, iLen, sTmp;
|
||||
@ -4332,12 +4317,10 @@
|
||||
/* Allow custom and plug-in manipulation functions to alter the data set which was
|
||||
* saved, and also reject any saved state by returning false
|
||||
*/
|
||||
for ( i=0, iLen=oSettings.aoStateLoad.length ; i<iLen ; i++ )
|
||||
var aCallbacks = _fnCallbackFire( oSettings, 'aoStateLoad', 'stateLoad', [oSettings, oData] );
|
||||
if ( $.inArray( false, aCallbacks ) !== -1 )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( oData !== null )
|
||||
@ -4744,12 +4727,16 @@
|
||||
function _fnCallbackFire( oSettings, sStore, sTrigger, aArgs )
|
||||
{
|
||||
var aoStore = oSettings[sStore];
|
||||
var aRet =[];
|
||||
|
||||
for ( var i=aoStore.length-1 ; i>=0 ; i-- )
|
||||
{
|
||||
aoStore[i].fn.apply( oSettings.oInstance, aArgs );
|
||||
aRet.push( aoStore[i].fn.apply( oSettings.oInstance, aArgs ) );
|
||||
}
|
||||
|
||||
$(oSettings.oInstance).trigger(sTrigger, aArgs);
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
|
||||
@ -6131,15 +6118,9 @@
|
||||
_fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" );
|
||||
_fnMap( oSettings, oInit, "asStripClasses", "asStripeClasses" ); // legacy
|
||||
_fnMap( oSettings, oInit, "asStripeClasses" );
|
||||
_fnMap( oSettings, oInit, "fnPreDrawCallback" );
|
||||
_fnMap( oSettings, oInit, "fnRowCallback" );
|
||||
_fnMap( oSettings, oInit, "fnHeaderCallback" );
|
||||
_fnMap( oSettings, oInit, "fnFooterCallback" );
|
||||
_fnMap( oSettings, oInit, "fnCookieCallback" );
|
||||
_fnMap( oSettings, oInit, "fnInitComplete" );
|
||||
_fnMap( oSettings, oInit, "fnServerData" );
|
||||
_fnMap( oSettings, oInit, "sServerMethod" );
|
||||
_fnMap( oSettings, oInit, "fnFormatNumber" );
|
||||
_fnMap( oSettings, oInit, "sServerMethod" );
|
||||
_fnMap( oSettings, oInit, "aaSorting" );
|
||||
_fnMap( oSettings, oInit, "aaSortingFixed" );
|
||||
_fnMap( oSettings, oInit, "aLengthMenu" );
|
||||
@ -6155,6 +6136,7 @@
|
||||
_fnMap( oSettings, oInit, "aoSearchCols", "aoPreSearchCols" );
|
||||
_fnMap( oSettings, oInit, "iDisplayLength", "_iDisplayLength" );
|
||||
_fnMap( oSettings, oInit, "bJQueryUI", "bJUI" );
|
||||
_fnMap( oSettings, oInit, "fnCookieCallback" );
|
||||
_fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" );
|
||||
|
||||
/* Callback functions which are array driven */
|
||||
@ -6162,6 +6144,11 @@
|
||||
_fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoStateSave', oInit.fnStateSaveCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoStateLoad', oInit.fnStateLoadCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' );
|
||||
|
||||
if ( oSettings.oFeatures.bServerSide && oSettings.oFeatures.bSort &&
|
||||
oSettings.oFeatures.bSortClasses )
|
||||
@ -10123,34 +10110,25 @@
|
||||
"sDestroyWidth": 0,
|
||||
|
||||
/**
|
||||
* Call this function every time a row is inserted (draw).
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions array for every time a row is inserted (i.e. on a draw).
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnRowCallback": null,
|
||||
"aoRowCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for the header on each draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions for the header on each draw.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnHeaderCallback": null,
|
||||
"aoHeaderCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for the footer on each draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnFooterCallback": null,
|
||||
"aoFooterCallback": [],
|
||||
|
||||
/**
|
||||
* Array of callback functions for draw callback functions
|
||||
@ -10160,25 +10138,19 @@
|
||||
"aoDrawCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for just before the table is redrawn. A return of
|
||||
* Callback functions for just before the table is redrawn. A return of
|
||||
* false will be used to cancel the draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnPreDrawCallback": null,
|
||||
"aoPreDrawCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for when the table has been initialised.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions for when the table has been initialised.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnInitComplete": null,
|
||||
"aoInitComplete": [],
|
||||
|
||||
/**
|
||||
* Cache the table ID for quick access
|
||||
@ -11184,6 +11156,39 @@
|
||||
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Row draw event, fired when a row is included in a draw
|
||||
* @name DataTable#row
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {node} nRow "TR" element for the current row
|
||||
* @param {array} aData Raw data array for this row
|
||||
* @param {int} iDisplayIndex The display index for the current table draw
|
||||
* @param {int} iDisplayIndexFull The index of the data in the full list of
|
||||
* rows (after filtering)
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataTables initialisation complete event, fired when the table is fully drawn,
|
||||
* including Ajax data loaded, if Ajax data is required.
|
||||
* @name DataTable#init
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} json The JSON object request from the server - only
|
||||
* present if client-side Ajax sourced data is used</li></ol>
|
||||
*/
|
||||
|
||||
/**
|
||||
* State load event, fired when DataTables loads the saved table state. Can be used
|
||||
* to add, remove or override saved information
|
||||
* @name DataTable#stateLoad
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} json The saved infromation from the local cookie
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
|
||||
* made to the server for new data (note that this trigger is called in fnServerData,
|
||||
|
@ -178,6 +178,39 @@
|
||||
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Row draw event, fired when a row is included in a draw
|
||||
* @name DataTable#row
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {node} nRow "TR" element for the current row
|
||||
* @param {array} aData Raw data array for this row
|
||||
* @param {int} iDisplayIndex The display index for the current table draw
|
||||
* @param {int} iDisplayIndexFull The index of the data in the full list of
|
||||
* rows (after filtering)
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataTables initialisation complete event, fired when the table is fully drawn,
|
||||
* including Ajax data loaded, if Ajax data is required.
|
||||
* @name DataTable#init
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} json The JSON object request from the server - only
|
||||
* present if client-side Ajax sourced data is used</li></ol>
|
||||
*/
|
||||
|
||||
/**
|
||||
* State load event, fired when DataTables loads the saved table state. Can be used
|
||||
* to add, remove or override saved information
|
||||
* @name DataTable#stateLoad
|
||||
* @event
|
||||
* @param {event} e jQuery event object
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} json The saved infromation from the local cookie
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
|
||||
* made to the server for new data (note that this trigger is called in fnServerData,
|
||||
|
@ -102,15 +102,9 @@ _fnMap( oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap" );
|
||||
_fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" );
|
||||
_fnMap( oSettings, oInit, "asStripClasses", "asStripeClasses" ); // legacy
|
||||
_fnMap( oSettings, oInit, "asStripeClasses" );
|
||||
_fnMap( oSettings, oInit, "fnPreDrawCallback" );
|
||||
_fnMap( oSettings, oInit, "fnRowCallback" );
|
||||
_fnMap( oSettings, oInit, "fnHeaderCallback" );
|
||||
_fnMap( oSettings, oInit, "fnFooterCallback" );
|
||||
_fnMap( oSettings, oInit, "fnCookieCallback" );
|
||||
_fnMap( oSettings, oInit, "fnInitComplete" );
|
||||
_fnMap( oSettings, oInit, "fnServerData" );
|
||||
_fnMap( oSettings, oInit, "sServerMethod" );
|
||||
_fnMap( oSettings, oInit, "fnFormatNumber" );
|
||||
_fnMap( oSettings, oInit, "sServerMethod" );
|
||||
_fnMap( oSettings, oInit, "aaSorting" );
|
||||
_fnMap( oSettings, oInit, "aaSortingFixed" );
|
||||
_fnMap( oSettings, oInit, "aLengthMenu" );
|
||||
@ -126,6 +120,7 @@ _fnMap( oSettings, oInit, "oSearch", "oPreviousSearch" );
|
||||
_fnMap( oSettings, oInit, "aoSearchCols", "aoPreSearchCols" );
|
||||
_fnMap( oSettings, oInit, "iDisplayLength", "_iDisplayLength" );
|
||||
_fnMap( oSettings, oInit, "bJQueryUI", "bJUI" );
|
||||
_fnMap( oSettings, oInit, "fnCookieCallback" );
|
||||
_fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" );
|
||||
|
||||
/* Callback functions which are array driven */
|
||||
@ -133,6 +128,11 @@ _fnCallbackReg( oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoStateSave', oInit.fnStateSaveCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoStateLoad', oInit.fnStateLoadCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' );
|
||||
_fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' );
|
||||
|
||||
if ( oSettings.oFeatures.bServerSide && oSettings.oFeatures.bSort &&
|
||||
oSettings.oFeatures.bSortClasses )
|
||||
|
@ -306,15 +306,14 @@ function _fnDraw( oSettings )
|
||||
var i, iLen;
|
||||
var anRows = [];
|
||||
var iRowCount = 0;
|
||||
var bRowError = false;
|
||||
var iStripes = oSettings.asStripeClasses.length;
|
||||
var iOpenRows = oSettings.aoOpenRows.length;
|
||||
|
||||
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
||||
if ( oSettings.fnPreDrawCallback !== null &&
|
||||
oSettings.fnPreDrawCallback.call( oSettings.oInstance, oSettings ) === false )
|
||||
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
|
||||
if ( $.inArray( false, aPreDraw ) !== -1 )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
oSettings.bDrawing = true;
|
||||
@ -382,17 +381,9 @@ function _fnDraw( oSettings )
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom row callback function - might want to manipule the row */
|
||||
if ( oSettings.fnRowCallback )
|
||||
{
|
||||
nRow = oSettings.fnRowCallback.call( oSettings.oInstance, nRow,
|
||||
oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j );
|
||||
if ( !nRow && !bRowError )
|
||||
{
|
||||
_fnLog( oSettings, 0, "A node was not returned by fnRowCallback" );
|
||||
bRowError = true;
|
||||
}
|
||||
}
|
||||
/* Row callback functions - might want to manipule the row */
|
||||
_fnCallbackFire( oSettings, 'aoRowCallback', 'row',
|
||||
[nRow, oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j] );
|
||||
|
||||
anRows.push( nRow );
|
||||
iRowCount++;
|
||||
@ -440,20 +431,12 @@ function _fnDraw( oSettings )
|
||||
anRows[ iRowCount ].appendChild( nTd );
|
||||
}
|
||||
|
||||
/* Callback the header and footer custom funcation if there is one */
|
||||
if ( oSettings.fnHeaderCallback )
|
||||
{
|
||||
oSettings.fnHeaderCallback.call( oSettings.oInstance, $(oSettings.nTHead).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(),
|
||||
oSettings.aiDisplay );
|
||||
}
|
||||
/* Header and footer callbacks */
|
||||
_fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
|
||||
|
||||
if ( oSettings.fnFooterCallback )
|
||||
{
|
||||
oSettings.fnFooterCallback.call( oSettings.oInstance, $(oSettings.nTFoot).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(),
|
||||
oSettings.aiDisplay );
|
||||
}
|
||||
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
|
||||
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
|
||||
|
||||
/*
|
||||
* Need to remove any old row from the display - note we can't just empty the tbody using
|
||||
|
@ -119,10 +119,7 @@ function _fnInitialise ( oSettings )
|
||||
function _fnInitComplete ( oSettings, json )
|
||||
{
|
||||
oSettings._bInitComplete = true;
|
||||
if ( oSettings.fnInitComplete )
|
||||
{
|
||||
oSettings.fnInitComplete.call( oSettings.oInstance, oSettings, json );
|
||||
}
|
||||
_fnCallbackFire( oSettings, 'aoInitComplete', 'init', [oSettings, json] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,11 @@ function _fnSaveState ( oSettings )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* xxx - This is horrible! What we really want to do is use a proper object and
|
||||
* pass that around - but jQuery doesn't have a toJson option. Either need to use
|
||||
* $.param or JSON.stringify or something else
|
||||
*/
|
||||
|
||||
/* Store the interesting variables */
|
||||
var i, iLen, sTmp;
|
||||
@ -96,12 +101,10 @@ function _fnLoadState ( oSettings, oInit )
|
||||
/* Allow custom and plug-in manipulation functions to alter the data set which was
|
||||
* saved, and also reject any saved state by returning false
|
||||
*/
|
||||
for ( i=0, iLen=oSettings.aoStateLoad.length ; i<iLen ; i++ )
|
||||
var aCallbacks = _fnCallbackFire( oSettings, 'aoStateLoad', 'stateLoad', [oSettings, oData] );
|
||||
if ( $.inArray( false, aCallbacks ) !== -1 )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( oData !== null )
|
||||
|
@ -244,11 +244,15 @@ function _fnCallbackReg( oSettings, sStore, fn, sName )
|
||||
function _fnCallbackFire( oSettings, sStore, sTrigger, aArgs )
|
||||
{
|
||||
var aoStore = oSettings[sStore];
|
||||
var aRet =[];
|
||||
|
||||
for ( var i=aoStore.length-1 ; i>=0 ; i-- )
|
||||
{
|
||||
aoStore[i].fn.apply( oSettings.oInstance, aArgs );
|
||||
aRet.push( aoStore[i].fn.apply( oSettings.oInstance, aArgs ) );
|
||||
}
|
||||
|
||||
$(oSettings.oInstance).trigger(sTrigger, aArgs);
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
|
@ -362,34 +362,25 @@ DataTable.models.oSettings = {
|
||||
"sDestroyWidth": 0,
|
||||
|
||||
/**
|
||||
* Call this function every time a row is inserted (draw).
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions array for every time a row is inserted (i.e. on a draw).
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnRowCallback": null,
|
||||
"aoRowCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for the header on each draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions for the header on each draw.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnHeaderCallback": null,
|
||||
"aoHeaderCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for the footer on each draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnFooterCallback": null,
|
||||
"aoFooterCallback": [],
|
||||
|
||||
/**
|
||||
* Array of callback functions for draw callback functions
|
||||
@ -399,25 +390,19 @@ DataTable.models.oSettings = {
|
||||
"aoDrawCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for just before the table is redrawn. A return of
|
||||
* Callback functions for just before the table is redrawn. A return of
|
||||
* false will be used to cancel the draw.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnPreDrawCallback": null,
|
||||
"aoPreDrawCallback": [],
|
||||
|
||||
/**
|
||||
* Callback function for when the table has been initialised.
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type function
|
||||
* @default null
|
||||
* @todo Make into an array so plug-ins can hook in
|
||||
* Callback functions for when the table has been initialised.
|
||||
* @type array
|
||||
* @default []
|
||||
*/
|
||||
"fnInitComplete": null,
|
||||
"aoInitComplete": [],
|
||||
|
||||
/**
|
||||
* Cache the table ID for quick access
|
||||
|
Loading…
x
Reference in New Issue
Block a user