New Posts New Posts RSS Feed: [SOLVED] Sorting Lists
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

[SOLVED] Sorting Lists

 Post Reply Post Reply
Author
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] Sorting Lists
    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!


Edited by Linguinut - 23-Oct-2007 at 5:20pm
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down