mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Change how the state loading callback functions operate - previously it would require that a cookie be available before the state loading callback is called. Now is state loading occurs at all the callback function will be fired - allowing easer integration with server-side state storage. I don't actually see a downside to this and it should be perfectly backwards compatible.
This commit is contained in:
parent
1550b37c79
commit
d4366df398
49
media/js/jquery.dataTables.js
vendored
49
media/js/jquery.dataTables.js
vendored
@ -4275,32 +4275,33 @@
|
||||
|
||||
var oData, i, iLen;
|
||||
var sData = _fnReadCookie( oSettings.sCookiePrefix+oSettings.sInstance );
|
||||
if ( sData !== null && sData !== '' )
|
||||
|
||||
/* Try/catch the JSON eval - if it is bad then we ignore it - note that 1.7.0 and before
|
||||
* incorrectly used single quotes for some strings - hence the replace below
|
||||
*/
|
||||
try
|
||||
{
|
||||
/* Try/catch the JSON eval - if it is bad then we ignore it - note that 1.7.0 and before
|
||||
* incorrectly used single quotes for some strings - hence the replace below
|
||||
*/
|
||||
try
|
||||
{
|
||||
oData = (typeof $.parseJSON == 'function') ?
|
||||
$.parseJSON( sData.replace(/'/g, '"') ) : eval( '('+sData+')' );
|
||||
}
|
||||
catch( e )
|
||||
oData = (typeof $.parseJSON == 'function') ?
|
||||
$.parseJSON( sData.replace(/'/g, '"') ) : eval( '('+sData+')' );
|
||||
}
|
||||
catch( e )
|
||||
{
|
||||
oData = null;
|
||||
}
|
||||
|
||||
/* 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++ )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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++ )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( oData !== null )
|
||||
{
|
||||
/* Store the saved state so it might be accessed at any time (particualrly a plug-in */
|
||||
oSettings.oLoadedState = $.extend( true, {}, oData );
|
||||
|
||||
@ -9966,7 +9967,7 @@
|
||||
|
||||
var oClasses = oSettings.oClasses;
|
||||
var an = oSettings.aanFeatures.p;
|
||||
|
||||
|
||||
/* Loop over each instance of the pager */
|
||||
for ( var i=0, iLen=an.length ; i<iLen ; i++ )
|
||||
{
|
||||
@ -10129,7 +10130,9 @@
|
||||
/* Build up the dynamic list forst - html and listeners */
|
||||
var qjPaginateList = $('span:eq(0)', an[i]);
|
||||
qjPaginateList.html( sList );
|
||||
$('a', qjPaginateList).bind( 'click.DT', fnClick ).bind( 'mousedown.DT', fnFalse )
|
||||
$('a', qjPaginateList)
|
||||
.bind( 'click.DT', fnClick )
|
||||
.bind( 'mousedown.DT', fnFalse )
|
||||
.bind( 'selectstart.DT', fnFalse );
|
||||
|
||||
/* Update the 'premanent botton's classes */
|
||||
|
@ -79,32 +79,33 @@ function _fnLoadState ( oSettings, oInit )
|
||||
|
||||
var oData, i, iLen;
|
||||
var sData = _fnReadCookie( oSettings.sCookiePrefix+oSettings.sInstance );
|
||||
if ( sData !== null && sData !== '' )
|
||||
|
||||
/* Try/catch the JSON eval - if it is bad then we ignore it - note that 1.7.0 and before
|
||||
* incorrectly used single quotes for some strings - hence the replace below
|
||||
*/
|
||||
try
|
||||
{
|
||||
/* Try/catch the JSON eval - if it is bad then we ignore it - note that 1.7.0 and before
|
||||
* incorrectly used single quotes for some strings - hence the replace below
|
||||
*/
|
||||
try
|
||||
{
|
||||
oData = (typeof $.parseJSON == 'function') ?
|
||||
$.parseJSON( sData.replace(/'/g, '"') ) : eval( '('+sData+')' );
|
||||
}
|
||||
catch( e )
|
||||
oData = (typeof $.parseJSON == 'function') ?
|
||||
$.parseJSON( sData.replace(/'/g, '"') ) : eval( '('+sData+')' );
|
||||
}
|
||||
catch( e )
|
||||
{
|
||||
oData = null;
|
||||
}
|
||||
|
||||
/* 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++ )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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++ )
|
||||
{
|
||||
if ( !oSettings.aoStateLoad[i].fn( oSettings, oData ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( oData !== null )
|
||||
{
|
||||
/* Store the saved state so it might be accessed at any time (particualrly a plug-in */
|
||||
oSettings.oLoadedState = $.extend( true, {}, oData );
|
||||
|
||||
|
@ -82,7 +82,7 @@ $.extend( DataTable.ext.oPagination, {
|
||||
|
||||
var oClasses = oSettings.oClasses;
|
||||
var an = oSettings.aanFeatures.p;
|
||||
|
||||
|
||||
/* Loop over each instance of the pager */
|
||||
for ( var i=0, iLen=an.length ; i<iLen ; i++ )
|
||||
{
|
||||
@ -245,7 +245,9 @@ $.extend( DataTable.ext.oPagination, {
|
||||
/* Build up the dynamic list forst - html and listeners */
|
||||
var qjPaginateList = $('span:eq(0)', an[i]);
|
||||
qjPaginateList.html( sList );
|
||||
$('a', qjPaginateList).bind( 'click.DT', fnClick ).bind( 'mousedown.DT', fnFalse )
|
||||
$('a', qjPaginateList)
|
||||
.bind( 'click.DT', fnClick )
|
||||
.bind( 'mousedown.DT', fnFalse )
|
||||
.bind( 'selectstart.DT', fnFalse );
|
||||
|
||||
/* Update the 'premanent botton's classes */
|
||||
|
Loading…
x
Reference in New Issue
Block a user