ReportView Sorting

Started by JTaylor, March 06, 2015, 10:07:10 AM

Previous topic - Next topic

JTaylor

I posted an example under COM for Stan which demonstrates the problem.   I'm trying to get smooth sorting for the ReportView.  That is, click it once it sorts ascending, click the same column and sorts descending.  Is there a way to make that smooth?   The best I can get is that is sometimes requires clicking a header twice.   Is there a way to make it sort programmatically?   That would be a nice addition if there isn't and that would solve the problem, I think.   While I know this isn't a "grid", it looks like a grid and end-users don't know that it isn't a grid so it would be nice if one could make it act as expected.

Jim

kdmoyers

I think you can control the sort for yourself using the @deRvhClick event.  Capture the event, resort the array yourself and redisplay the reportview.  You can even then indicate the current sort by dynamically changing the header (I make the header ALL CAPS when it's sorted by that column). 
-Kirby
The mind is everything; What you think, you become.

JTaylor

Thanks.  That would be one way.   Would be nice if it could be built into the ReportView though, especially since sorting is already there.

Jim

kdmoyers

I place the rvheader event code in the switch/case statement just ahead of the initialization code, and let it fall through into the normal report view control initialization.  That way, all the rvheader event does is flip a flag saying how the sort should be done. 

In my case, a preprogrammed solution would not have worked, since my ordering is kinda tricky, sometimes two fields ascending, sometimes one field descending.  I put the sort logic in my SQL query and let the SQLServer handle it.

-Kirby
The mind is everything; What you think, you become.

JTaylor

Yes.  Mulit-Column sorting would be great but figured that would be too much for which to ask.

Jim