Retaining a tables column sort

A requested feature from our users is to maintain a tables column sorting when they switch to another window and then back to the table.

It looks like I could get the number of the selected column when they switch to the other window and then use the sortByColumn() function when they return to accomplish most of this. However I don’t see a way to determine if the column sort is ascending or descending. Does anyone know how to get that value or have a better idea for getting this done?

Edit: the selected column does not indicate anything about the column sorting. I didn’t check that out before I posted this. It only indicates which column the user clicked on when click a row or column header.

As of right now there is now good way to accomplish this other than setting the cache mode of the window to always. If the window is always cached then when you navigate back to it it will be in the same state that you left it in. This will include all text boxes and other components as well as the table.