When you refresh a page - is there a way to retain the previous table length?

When you refresh a page - is there a way to retain the previous table length?

tmitch68tmitch68 Posts: 3Questions: 0Answers: 0
edited October 2013 in General
Hello,

I'm relatively new to DataTables. I definitely love it.

I understand how you can change the default length of a table - by editing the iDisplayLength configuration variable.

Is there any way to allow the app to save the last length the user selected? For example, if the default is say 20, but the last length selected by the user is 30, I would like the table length to still be 30 after the user re-freshes the page.

Is there any way to do this?

thanks in advance,
Tim

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You could use the built in state saving ( bStateSave ).

    Allan
  • tmitch68tmitch68 Posts: 3Questions: 0Answers: 0
    Thanks Allan - when I set the bStateSave option to true - either in the onReady function or in the jquery.dataTables.js file, it throws the following error:

    TypeError: oColumn is undefined
    [Break On This Error]

    for ( j=0, jLen=oColumn.asSorting.length ; j
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I think we'd need a link to the page to debug it. Are the number of columns changing between pages?

    Allan
  • tmitch68tmitch68 Posts: 3Questions: 0Answers: 0
    Thanks Allan - the app is actually on a classified network, so I'm not allowed to share a link.

    It happens the very moment I set bStateSave option to true. Also, it happens with pretty much any table - even a simple one like this:




    Column 1
    Column 2




    Data 1
    Data 2




    As soon as I set bStateSave to true; it happens.

    Has this ever happened to anyone before?

    Thanks,
    Tim
This discussion has been closed.