Does client state saving work for individual colum filter value?

Does client state saving work for individual colum filter value?

andrew_mandrew_m Posts: 31Questions: 0Answers: 0
edited March 2009 in General
Hi, Allan.
I'm using datatables 1.5 beta 5 and added one column filtering ability, via fnFilter function. I passed column index and filter value, and everything works well. However when i turned state saving on, filter value for that column does not appear in cookie. I tried sorting, and cookie value updated with sorting info as expected. There is "sFilter" parameter in cookie, which stays empty, even after fnFilter function call.

Is this a bug, or i'm doing something wrong?

Replies

  • allanallan Posts: 57,679Questions: 1Answers: 9,193 Site admin
    Hi Andrew,

    Actually no, the individual column filtering isn't saved in the cookie. I wasn't sure about including this or not, however, that fact that you are asking about it suggests that it should be in! ;-)

    I'll make sure it's in the next beta. If you want a diff to 1.5 beta 5, let me know.

    Allan
  • andrew_mandrew_m Posts: 31Questions: 0Answers: 0
    Hi Allan.

    Well, seems filter value is the same peace of grid state, as an order value or page number.

    If its not too hard, i\d be glad to get a diff :) But if the next beta is planned for today or tomorrow, i'm fine to wait for it :) If not, could you please send a diff to andrew.melnichuk@mondo.com.ua.

    Again, thanks for the great jquery component!
  • allanallan Posts: 57,679Questions: 1Answers: 9,193 Site admin
    Hi Andrew,

    Next beta is probably a little while away, so here is the two function you need to replace. Just put these in place of what you currently have.

    Part of the reason I didn't originally include this is that this is accessable through the API only, so once the table has loaded, what you will need to do is (if you are using input boxes like my example) is parse through the aoPreSearchCols parameter for the tables settings, and populate your input boxes with the required values.

    Hope this helps.
    Allan


    [code]
    /*
    * Function: _fnSaveState
    * Purpose: Save the state of a table in a cookie such that the page can be reloaded
    * Returns: -
    * Inputs: object:oSettings - dataTables settings object
    */
    function _fnSaveState ( oSettings )
    {
    if ( !oSettings.oFeatures.bStateSave )
    {
    return;
    }

    /* Store the interesting variables */
    var sValue = "{";
    sValue += '"iStart": '+oSettings._iDisplayStart+',';
    sValue += '"iEnd": '+oSettings._iDisplayEnd+',';
    sValue += '"iLength": '+oSettings._iDisplayLength+',';
    sValue += '"sFilter": "'+oSettings.oPreviousSearch.sSearch.replace('"','\\"')+'",';
    sValue += '"sFilterEsc": '+oSettings.oPreviousSearch.bEscapeRegex+',';

    sValue += '"aaSorting": [ ';
    for ( var i=0 ; i
  • andrew_mandrew_m Posts: 31Questions: 0Answers: 0
    Thanks alot, Allan for you support. This will definitely help us!
This discussion has been closed.