Question

Tablesorter is working wonderfully (thanks to Mottie for all the very useful updates) but I can't find a way to save the currently selected row and restore it after postback.

I'm using the 'scroller' and saveSort' widgets, which work just fine and the latter correctly restores the selected sort order, but I'm not managing to retrieve the current scrollPos (much less restore it afterwards) so the selected row is out of view if not within the default viewport. I must be missing something obvious or trying to overcomplicate this :). In the snippet below, which is after the tablesorter is initialised, the alert isn't triggered:

var thisGrid = $("#myGrid")
$(thisGrid).scrollParent().scroll(function () {
// $("#scrollPos").val($(thisGrid).scrollParent().scrollTop());
alert($(thisGrid).scrollParent().scrollTop());
});
$(thisGrid).scrollParent().scrollTop($("#scrollPos").val());

I've also tried at a .NET page level

Page.MaintainScrollPositionOnPostback="true"

Thanks for any helpful suggestions.

No correct solution

OTHER TIPS

I don't think it can work. The Page.MantaintScrollPositionOnPostback is an ASP.NET specifica feature while tablesorter is "server unaware".

I think the best solution for you is to avoid postbacks and replace them with partial posts (using Update Panels) or AJAX calls.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top