fnDraw without resetting pagination
fnDraw without resetting pagination
mariusc80
Posts: 1Questions: 0Answers: 0
I'm using 1.9.4 with server side data from a ASP.Net Web service.
I'm also using the fnDraw() method as means for forcing refresh.
Currently the fnDraw tries to use oSettings.iInitDisplayStart to get the page number before refresh, but the value is set only in _fnInitialise() and _fnLoadState(). So if you refresh the page it works ... but if you do a ajax refresh ... back to initial page.
To 'solve' this I changed:
[code]
this.fnDraw = function( bComplete )
{
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
if ( bComplete === false )
{
_fnCalculateEnd( oSettings );
_fnDraw( oSettings );
}
else
{
_fnReDraw( oSettings );
}
};
[/code]
to
[code]
this.fnDraw = function( bComplete )
{
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
// Save the page status on redraw
if (oSettings.oFeatures.bStateSave)
{
oSettings.iInitDisplayStart = oSettings._iDisplayStart;
}
if ( bComplete === false )
{
_fnCalculateEnd( oSettings );
_fnDraw( oSettings );
}
else
{
_fnReDraw( oSettings );
}
};
[/code]
Don't know if the current functionality is a feature.
I also read http://datatables.net/forums/discussion/1309/fndraw-without-resetting-pagination/p1
I'm also using the fnDraw() method as means for forcing refresh.
Currently the fnDraw tries to use oSettings.iInitDisplayStart to get the page number before refresh, but the value is set only in _fnInitialise() and _fnLoadState(). So if you refresh the page it works ... but if you do a ajax refresh ... back to initial page.
To 'solve' this I changed:
[code]
this.fnDraw = function( bComplete )
{
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
if ( bComplete === false )
{
_fnCalculateEnd( oSettings );
_fnDraw( oSettings );
}
else
{
_fnReDraw( oSettings );
}
};
[/code]
to
[code]
this.fnDraw = function( bComplete )
{
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
// Save the page status on redraw
if (oSettings.oFeatures.bStateSave)
{
oSettings.iInitDisplayStart = oSettings._iDisplayStart;
}
if ( bComplete === false )
{
_fnCalculateEnd( oSettings );
_fnDraw( oSettings );
}
else
{
_fnReDraw( oSettings );
}
};
[/code]
Don't know if the current functionality is a feature.
I also read http://datatables.net/forums/discussion/1309/fndraw-without-resetting-pagination/p1
This discussion has been closed.
Replies
Allan