Print Page | Close Window

[SOLVED] Sorting Lists

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=515
Printed Date: 01-Apr-2025 at 7:56pm


Topic: [SOLVED] Sorting Lists
Posted By: Linguinut
Subject: [SOLVED] Sorting Lists
Date Posted: 19-Oct-2007 at 1:40pm

One of my lists is not sorting by the field that I would like.  Here is the code from the ListConverterService:

private ListConverter MakeMachineListConverter()
{
    EntityQuery aQuery = new EntityQuery(typeof(MachineMaster), MachineMaster.MachineDivisionEntityColumn, EntityQueryOp.EQ, mDivision);
    EntityListConverter<MachineMaster> converter = new EntityListConverter<MachineMaster>(EntityManager, EntityPropertyDescriptors.MachineMaster.MachineNumber.Name, Editability.Optional, aQuery, true, ListSortDirection.Ascending, EntityPropertyDescriptors.MachineMaster.MachineIdx.Name);
    AddListManager_KeepExistingEntitiesOnly(converter);
    return converter;
}
 
private ListConverter MakeMachineIdListConverter()
{
    ListConverter converter = CopyConverter<MachineMaster>(ListConverterNames.MachineList);
    converter.ValueMember = EntityPropertyDescriptors.MachineMaster.MachineIdx.Name;
    return converter;
}
 
I have tried several variations of the creation of the EntityListConverter.  None seem to work...all end up with the primary index sort.  Can anyone see what I am doing wrong?
 
Btw, the final control that displays this list is a LookUpEdit control from DevExpress.  I have other lists that work beautifully...just not this one.  Odd.
 
Thanks!



Replies:
Posted By: Bill Jensen
Date Posted: 19-Oct-2007 at 2:55pm

Does CopyConverter<>() preserve the sort specification?  You might try calling Sort(displayPropertyName, sortDirection) on the copied converter.

 
Bill J.


Posted By: Linguinut
Date Posted: 19-Oct-2007 at 4:22pm
I removed the AddListManager_KeepExistingEntitiesOnly method...and it works, now.
 
CopyConverter should preserve the sort.  I do not see anything in the method that would alter the sort.



Print Page | Close Window