How to access and/or save sorting/filtering on current grid?

How to access and/or save sorting/filtering on current grid?

mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
edited May 2010 in General
I'm in a position where I need to save the current "view" or state of a datatable and be able to apply that saved view at a later date on demand.
Per user, they will be able to save any given view/state of their grid and then on a single click, bring any given saved view back with fresh data.

I can walk the headers to find the current structure of the grid, but how can I go about accessing the sorting of each column as well as any filtering?

Thanks in advance.

Replies

  • allanallan Posts: 65,467Questions: 1Answers: 10,874 Site admin
    The settings object contains all of the information that you will need to do this (fnSettings). You'll need to look at the code to see which variables you want to store (aaSorting for example) so they can be re-applied later. The settings object is only documented in the code, not on web-pages on this site - but it should be fairly well commented :-)

    Will be interesting to know how you get on with this.

    Regards,
    Allan
  • mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
    edited May 2010
    I was actually searching through the objects programmatically while debugging yesterday and I did find it.

    This is what I was looking for. Thanks for your reply though. :)

    var settings = oTable.fnSettings();
    var sorting = settings.aaSorting[0];
    var sortedColumn = sorting[0];
    var sortedDirection = sorting[1];
This discussion has been closed.