I'm using jQuery Tablesorter plugin, it works fine. However there is a problem. Imagine that you have some sorting order, but you want to live the page and come back shortly. Unfortunately when you come back you will get the initial sorting order which is simply wrong. So I was trying to find a clue how to save the state of Tablesorter (remember the sorting choice when leaving the page) in some variable and pass it via URL using _GET in php. Any ideas and help will be appreciated.
I did a little research and found out the following:
1.You can read the current sortlis
<script>
$(window).unload( function () {
var sortList;
$(table).tablesorter().bind("sortEnd", function(sorter)
{
sortList = sorter.target.config.sortList;
$_GET['sortList'] = sortList;
});
}
);
</script>
2.I've tried to save the sortlist like above and read it when page loads:
<script>
$(document).ready(function()
{
sortList=$_GET['sortList'];
$.tablesorter.defaults.widgets = ['zebra'];
$.tablesorter.defaults.sortList = [[1,0]];
$("table").tablesorter();
}
);
</script>
Doesn't work, I think these 2 lines are questionable:
sortList=$_GET['sortList']; ... $_GET['sortList'] = sortList;
I'm mixing here languages JavaScript with PHP and data types. But I'm not a professional programmer and I can't connect the dots. Any help?
Alex