StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
»
Multiple fields sorting in a ListView?
Multiple fields sorting in a ListView?
Post Reply
Like
0
Multiple fields sorting in a ListView?
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Topic Details
Share Topic
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi guys,
Is it possible to sort a ListView by multiple columns (fields) combinations?
Currently I have a listview which I am adding a whole bunch of records and would like to have these be sorted specifically by a combination of columns (fields).
This ListView is getting the data via a BO.CopyDataFrom(), and I have specified the BO.Sort field property, but when adding the records to the BO and Requery() the ListView, the records are not shown properly sorted.
Edhy Rijo
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
Is it possible to sort a ListView by multiple columns (fields) combinations?
No. If you are going to do this then you need to sort the business object or your query coming in. If you have the need for this to be dynamic in any way, then you will need to sort the BO and repopulate the list that way versus column sorting within the list. So my point is, you can get this behavior, but not through the standard ListView column sorting....unless....you create your own column sorter, which is a possibility also.
In this case, you can just create a class that implements the System.Collections.IComparer interface (very easy) then sorts as you need. You would create an instance and set the ListViewColumnSorter property on the listview AFTER the load has already happened. This way you overwrite the base logic.
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Thanks Trent. I will go with the BO.Sort instead since I need to do some process with the BO that requires the records to be in the specified order.
Talking about the BO.Sort & BO.Filter I know that with the BO.Filter if adding new records during my process will filter out those records that does not meet the filter condition (which makes sense), so I should remove the filter then re-apply it, so in case of the BO.Sort, is there anything I should be aware of while doing my record process?
Also, just to be sure, if I set the BO.Sort in the OnLoad() of the form it will be respected everywhere the BO is used?
Edhy Rijo
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
Also, just to be sure, if I set the BO.Sort in the OnLoad() of the form it will be respected everywhere the BO is used?
Yes. It will stay set until set to something else. So you should be fine.
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Cool, thanks!
Edhy Rijo
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search