Hello.
I am showing the database table using tableSorter jquery plugin. I have large number of records so I have to paginate. If there is only one page of data, I can allow tablesorter to do client sorting, however, when I have more pages I need to specify sorting order using ORDER BY sql statement so that all pages are affected.
I tried using startSort event without much success. First I modified tableSorter code to get as an argument sortList. Then I was using ajax call inside startSort event to call MVC handler that is parsing sortList array to construct valid sql ordering. I was also experiencing problems with event not being fired (when I specify multiple sort columns using shift) or event triggering 2 times.
Does anybody knows some plugin or knows a way to implement this ?
Short code snippet of stuff I tried looks like this;
function OnAjaxSuccess() {
SortList = typeof SortList == "undefined" ? [] : SortList
$("table").tablesorter
({
...
sortList = SortList
});
$("table").bind("sortStart", function(event, newSortList)
{
if (PageCount = 1) return;
SortList = newSortList;
var url = '/Report/Sort/' + SortList.toString();
$("#Report").load(url, null, OnAjaxSuccess );
})
Thanks.