View Single Post
  #9 (permalink)  
Old July 28th, 2008, 01:57 AM
Old Pedant Old Pedant is offline
Friend of Wrox
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

I think Lee Dummond has it right: We are both saying the same thing.

I was, indeed, saying that if you change the sort order you *MUST* start the paging all over. Meaning you can't use the standard datagrid paging. But I thought the whole point of this was to forget all about standard datagrid paging and "roll your own."

Anyway, yes: If the user changes the sort, then kill the entire paging and start it all over. However you have to force that to happen.


And Imar; You missed my point about doing both paging and sorting *ALL* in the browser. I was, indeed, saying that *IF* the ENTIRE DATATABLE (or whatever it is you are paging/sorting) is small enough to send to the browser, *THEN* do *ALL* your sorting and paging in the browser. Forget standard junky ASP.NET server-side work, completely. Basically, you create "data rows" in the JS code (object that represent the data rows, of course) in an array, where the array is sorted according to the user's choice. You only show one page's worth of the data rows, and when the user asks for another page, you go get it from the JS array, never even dreaming about going back to the server.

I have successfully done this in JSP code and have passed data-table-equivalents to JS coding that were as large as a few hundred rows. Yes, the first time you hit the page the page load is a little slower, but then after that there are *NO* round trips to the server.

Patently only works when the *TOTAL* amount of data is small enough, but "small enough" can be amazingly large. And well worth the trouble if you have a loaded server.