0

I'm working on a Tapestry project with the library JQuery.

I use jquery/datatable to display my objects. I want to save searches in datatable, and so I set the boolean bStateSave to true. It works, but after a few tests, I get a blank page, and I have to clear the cache for the application to work again.

The options are :

public JSONObject getOptions() {      
    String option = "{ aaSorting: [[ 0, 'asc']], aoColumns: [ { sType: 'string' }, { sType: 'string' }, { sType: 'string' }, { sType: 'string' }, { sType: 'string' },{ sType: 'string' }, { bSortable : false } , {bSortable : false} , {bSortable : false}] , bJQueryUI : true, bStateSave : true}";
    JSONObject json = new JSONObject(option);

    return json;  
}

Cookies :

Cookies

What is the problem ?

Thank you !

1
  • Can you copy / paste the result of java.net.URLDecoder.decode(cookieString)
    – lance-java
    Sep 17, 2013 at 12:32

2 Answers 2

0

Without seeing any code it's difficult to see what you're doing wrong. As stated here the bStateSave flag causes the datatable to save the user actions to a clientside cookie.

It's possible that you have a filter stored in your cookie that does not match any records coming from your server meaning your grid is empty.

Most browsers these days have tools to inspect your cookies.

3
  • Thank you. I just added the code used. I'll try to see the contents of cookies. Sep 17, 2013 at 11:25
  • Only three cookies are created for tables. When I open a fourth table, there is a problem: randomly, I get a blank page or it continues to operate, but without saving the state of the fourth table. Sep 17, 2013 at 12:23
  • Again, you are giving bugger all details!!! I have no idea what your 4 tables are. Can bStateSave even support multiple datatables on a page? Do the cookie names include the id of the table or do they assume one datatable on a page? THROW ME A FREAKING BONE HERE!!!
    – lance-java
    Sep 17, 2013 at 12:29
0

You might be hitting the max cookie size

http://browsercookielimits.x64.me/

5
  • I found this : datatables.net/forums/discussion/14248/… but I do not know how to integrate this code with tapestry. Sep 17, 2013 at 12:56
  • That link suggests that you've hit the max cookie length and to use fnStateSave and fnStateLoad to save to local storage. To add a function to your JSONObject, you can call JSONObject.set("fnStateSave", new JSONLiteral("function (oSettings, oData) { ... }"));
    – lance-java
    Sep 17, 2013 at 13:17
  • I don't have the function set, but append, accumulate... I tried json.append("fnStateSave", new JSONLiteral("function (oSettings, oData) {localStorage.setItem('dt-' + window.location.pathname, JSON.stringify(oData));}")); but it doesn't work. Sep 17, 2013 at 13:31
  • Yes it's ok with put or accumulate. Thank you for help. Sep 17, 2013 at 14:07
  • It will work with accumulate but it's incorrect!!! fnStateSave and fnStateLoad must be a function and can not be an array. Accumulate will create an array when called twice or more for the same key.
    – lance-java
    Sep 17, 2013 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.