bStateSave doesn't save extra parameters?!

bStateSave doesn't save extra parameters?!

newfield86newfield86 Posts: 5Questions: 0Answers: 0
edited May 2012 in General
Hi all,

Is there any way to save extra parameters, like:

[code]
"fnServerParams": function ( aoData )
{
aoData.push( {"name": "year", "value": $('#year').val() },
{"name": "status", "value": $('#status').val() } );
}
[/code]

into the cookie that is created by bStateSave? I can't figure out how. I have already looked into the function below, but dont see that extra parameters are saved.

[code]
function _fnSaveState ( oSettings )
{
if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying )
{
return;
}

/* Store the interesting variables */
var i, iLen, bInfinite=oSettings.oScroll.bInfinite;
var oState = {
"iCreate": new Date().getTime(),
"iStart": (bInfinite ? 0 : oSettings._iDisplayStart),
"iEnd": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
"iLength": oSettings._iDisplayLength,
"aaSorting": $.extend( true, [], oSettings.aaSorting ),
"oSearch": $.extend( true, {}, oSettings.oPreviousSearch ),
"aoSearchCols": $.extend( true, [], oSettings.aoPreSearchCols ),
"abVisCols": []
};

for ( i=0, iLen=oSettings.aoColumns.length ; i

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    edited May 2012
    Mmmm... if you open http://datatables.net/extras/thirdparty/ColReorderWithResize/ColReorderWithResize.js and search for 'state saving' you can find how this plugin saves the order of the columns using the state saving function. Maybe you can find your answer there?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
  • newfield86newfield86 Posts: 5Questions: 0Answers: 0
    Thnx Allan, couldn't found those options. For the unexperienced user, here my solution:

    [code]
    "fnStateSaveParams": function (oSettings, oData)
    {
    oData.year = $('#year').val();
    oData.status = $('#status').val();
    },
    "fnStateLoadParams": function (oSettings, oData)
    {
    $('#year').val( oData.year );
    $('#status').val( oData.status );
    },
    [/code]
This discussion has been closed.