Sorting Listview


Author
Message
Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
My experience thus far indicates that in a when a field is processed within a listview so that it includes a format string or uses the "PopulatedThroughEvent" method, the sorting does not accurately reflect the base value.

For example, if I'm sorting on a name column and want to add a format string (<a href= "... ) to make the name be a link when viewed on the web page, the sorting gets messed up and does not display the list properly.

Has anyone else experienced this also?  If it's by design, then I request that the design be changed <smile>.

At least in the case of creating a hyperlink, I would have expected that the sorting would still be on the base value of the field (or whatever the displayed text of the link is if the two are not the same), but this does not appear to be the case.

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Actually it will already do this intrinsically for a Date or Date/Time value.  As Ben mentioned above, we have a ListViewItemSorter class that you can implement as the ListViewSorter on a ListView.  This class, which you can look at since you get the source, is an IComparer implementation which sorts on character data while testing for date values and sorting correctly there.  If you need more functionality, it is very easy to write a comparer class as there is only a single method that you have to write that compares two values to see which one should rank higher.  You can also look at the ListViewItemSorter class to see what we did and you can expand on that if you have the need.  This would be your fastest solution.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

How to do this for browseresult? Which event to handle? Any sample for ListViewItemSorter class?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, there is a ListViewItemSorter sample in the AdvancedListView sample (it might also be called SampleListViewPopulation). 

As for the BrowseDialog, I don't know that there is a way change the sorting on the BrowseDialog.  It currently uses the default ListViewItemSorter and the events have not been exposed for you to override the sorter that is used.

Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Thank you for reply.



Hope you could provide some way to overcome this very soon, because my customer complaint that current date field sorting by ASCII is not making any sense.



Thank you
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search