EnhancedList filtering does not work correct with non-string types.


Author
Message
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Hi.

I am using an EnhancedList to display the contents of a BO.

When trying to sort the columns in the grid, sorting does not work correctly for numeric columns. Also when enabling filtering, filter conditions like <, >, <=, >= do not work correct either with numeric columns. It looks like the EnanhancedList makes all columns of type string.

Is there a way to overcome this so that filtering works ok?

Thank you

StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Does it sort the numeric columns at all, does the sorting operate incorrectly... like 1 and 11 come before 2 and 3?
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
The following column displays balances. It is sorted as you can see (by the little arrow in the column header), and also filtered to display all values bigger than 100 euros.

This is an EnhcanedList bound to a Customer BO.


George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Let me know if you might need a sample application, to help you with that...
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
A sample always helps and speeds up the process can we can just run it to get to the crux of the issue.  For whatever it is worth, we don't actually do anything on the sort.  The EnhancedList is just an XtraGrid that acts more like a listview than a grid.  So this sorting logic isn't actually something that we implemented....this should be the basic grid functionality.  Now there could be something coming over into the grid as a different type or something of that nature which may be causing the issue, so I would like to look at a sample so that we can at least determine where the issue is manifesting itself.
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Trend, here's a sample.

It is a small BO with only three properties and the DB it uses. The DB contains a single table, with only those three columns. Balance is a money property.

Run the application and try to sort by the Balance field. The sort does not really work as it should be. Also if you enable filtering, try to show all rows with Balance bigger than 10. You will get -10 also. The DisplayFormat of the columns is set to Numeric but that doesn't seem to work. I think that somewhere along loading of the grid, the column looses its data type and it is turned to a string. Perhaps you during formatting of the column.

I hope this will help you find the cause.

Thank you...

Attachments
EnhancedListFilter.rar (95 views, 689.00 KB)
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, before I even look at the sample, you are correct in a point that you made.  All data is ultimately turned into a string.  Just as the combos and standard SF ListView work, so does the EnhancedListView.  When the columns  are created, they are created using the String.Format command.  This logic is not going to change, and that is why I recommended using a grid (to you or another user) the other day regarding this type of data.  The EnhancedList was created ONLY to emulate the functionality of a ListView.

One thing you can do though, is sort the BO before you populate the list instead of relying the grid to sort the columns.  So before you call the Requery method on the list, set the sort of the BO and then load.  You can populate a BO on the form or user control, then within the List, use the CopyDataFrom method.  Then in the ListPopulating event of the EnhancedList, pass the BO that is populated and sorted.  This will then load the list as you would like.

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