AutoColumnSort


Author
Message
Geoff Hirst
Geoff Hirst
StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Guys,

I just switched out my code for sorting on a listview and used the built in capabilities, and suddenly my form takes 4 years to load as the LV control sorts every item over and over everytime there is an addition. Doh!

So, I switch off autocolumnsoft and zoom, done in 2 seconds. So, I am now doing an order by from my proc, but it orders on the second column of the listview, is there any chance of being able to set the column that the sort is done on when the lv control is first drawn?

thanks

Geoff.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Geoff,



If you are sorting the data on your SP, then in set the ListView.AutoColumnSort = False so it will respect whatever sorting you have at the SP level.



Also if you are using a BO to populate your ListView, you can also have a Sort condition on the BO and when requery the listview it will load the data already sorted for you.

Edhy Rijo

Geoff Hirst
Geoff Hirst
StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Hi Edhy,

Thanks for the response. I have no problem doing the sort, it's just that the listview defaults to sorting on column 0 (or is it 1?) when you turn on AutoColumnSort. In my case I want the sort to be done on column 1 (or is that column 2?). If you could just enter an initial sort column number, that would be as if you had clicked on that columnheader, that is what I need.

Unless there is some really neat way of mimicking the column click event?

thanks

Geoff.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,



Column index start from 0, and in the ListView Sorting properties you have total control on which column you want the ListView to be sorted.



What I was saying before is that if you have your source BO properly sorted, then you would not need to use the ListView Sorting features as the underline data would be already sorted in any way you wanted and when calling ListView.Requery() it will bring the data already sorted.

Edhy Rijo

Geoff Hirst
Geoff Hirst
StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)StrataFrame User (219 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Hi Edhy,

I am offering the listview sorting options for my customers benefit, but when the form first appears I would like it to be sorted by column 1. When I turn on AutoColumnSort, it changes the sort to column 0, so any pre-sorting I have done is lost. If I turn on AutoColumnSort before I populate the LV, the form takes a long time to load as there could be a fairly large number of records here.

What I need to be able to do is tell the LV to sort on column 1 rather than 0. Most customers expect to be able to click on column headers and get a sort on that column.

Unless I reinstate all my previous code and do the sorting manually.

thanks

Geoff.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Actually this sorting logic is being done by the standard .NET ListView. However, I am not sure why it woulc be firing like this as I have some massive lists that get loaded and I use this feature a lot and have not experienced this. So I would be curious as to what logic you have going on behind the scenes here. Not to say that there isn't something that could be done, but I have not experience this slowness as the sort doesn't fire until after the the Requery. The only other time it fires is when a column header is clicked...so there has to be something going on here.



Not that it will resolve this issue, but in the 1.7 release you will be able to see the new StrataListView which is a list written from scratch and has native sorting and supports native data types for true sorting. A sort value can be supplied to every column which doens't have to match the text displayed within the column. So you can truly sort dates, integers, strings, etc. With this logic you can even make check boxes (which are allowed in any column) or images (which are also allowed in any column) to be sortable.
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