viewpoint-particle

Author Topic: ReportView Sorting  (Read 3601 times)

JTaylor

  • Pundit
  • *****
  • Posts: 1655
    • Data & Stuff Inc.
ReportView Sorting
« on: March 06, 2015, 10:07:10 am »
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

  • Sr. Member
  • ****
  • Posts: 409
Re: ReportView Sorting
« Reply #1 on: March 06, 2015, 11:19:45 am »
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

  • Pundit
  • *****
  • Posts: 1655
    • Data & Stuff Inc.
Re: ReportView Sorting
« Reply #2 on: March 06, 2015, 12:07:03 pm »
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

  • Sr. Member
  • ****
  • Posts: 409
Re: ReportView Sorting
« Reply #3 on: March 06, 2015, 01:49:21 pm »
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

  • Pundit
  • *****
  • Posts: 1655
    • Data & Stuff Inc.
Re: ReportView Sorting
« Reply #4 on: March 06, 2015, 02:06:25 pm »
Yes.  Mulit-Column sorting would be great but figured that would be too much for which to ask.

Jim