You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to navigate away from a page after sorting, and come back to it with the sorting entact - the way you left it. I am thinking localStorage or maybe cookies ??
The text was updated successfully, but these errors were encountered:
Well I have come up with this and it works using the sessionStorage object. Saves the sort column and direction for a session....
Please let me know if there are ways to improve this code...
$(function(){
var table = $("table").stupidtable();// call function
if (sessionStorage.data_column) { // check if sessionStorage exists
var thcol1 = sessionStorage.getItem("data_column"); //retrieve sort col
var thdir1 = sessionStorage.getItem("data_direction"); //retrieve sort dir
var $th_to_sort = table.find("thead tr th").eq(thcol1); //select sort column
$th_to_sort.stupidsort(thdir1); //call direction
}
table.bind('aftertablesort', function (event, data) {
sessionStorage.setItem("data_direction", data.direction); // data.direction - the sorting direction (either asc or desc)
sessionStorage.setItem("data_column", data.column); // data.column - the index of the column sorted after a click
});
});
Is it possible to navigate away from a page after sorting, and come back to it with the sorting entact - the way you left it. I am thinking localStorage or maybe cookies ??
The text was updated successfully, but these errors were encountered: