Reset being issued after Sort

Posts   
 
    
Dan Suitor
User
Posts: 16
Joined: 07-Feb-2008
# Posted on: 09-Jul-2008 01:37:33   

I’m trying to resort an EntityCollection in memory, and have successfully achieved this using the Sort method and implementing an IComparer through which the comparison is being done. The problem I’m running into is that after the sort completes, the EntityCollection is issuing a ListChangedEventHandler with the ListChangedEventArgs containg a ListChangedType of ListChangedType.Reset. This causes problems with my UI which is bound to the collection. I’m not sure why a ListChangedType.Reset is being done, if all that was done was a resort. I’ve noticed a similar problem when using Views. Is there any way around this?

Thanks Dan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Jul-2008 04:57:07   

Hi Dan, What LLBLGen version are you using? In which way that causes problems with your UI?

David Elizondo | LLBLGen Support Team
Dan Suitor
User
Posts: 16
Joined: 07-Feb-2008
# Posted on: 09-Jul-2008 16:03:07   

David, The product version number of SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll is 2.5.08.0214 and the product version number of SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll is 2.5.07.0906.

In the UI, I have the collection being displayed in a 3rd party grid control (written by Infragistics). When it sees the Reset, it reloads the contents of the grid. This causes the grid to scroll back to the top. This is unacceptable, especially if all that happened was a resort of the collection.

Dan

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 09-Jul-2008 17:33:44   

The Reset is expected, as the collection is completely changed (could be completely changed) so there's nothing else to signal than a reset.

Is this a web or windows application? And how is the collection bound to the grid? (please post a code snippet)

Dan Suitor
User
Posts: 16
Joined: 07-Feb-2008
# Posted on: 09-Jul-2008 17:48:07   

To answer your questions:

This is a Windows Application.

The Binding is done via a Binding object, where initParam.m_ItemSourceBinding is a IEntityCollection2.

-- Code Snipet -- // Set the item source's binding Binding binding = new Binding(); binding.Source = initParam.m_ItemSourceBinding; theGrid.SetBinding(DataSourceProperty, binding);

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 10-Jul-2008 11:29:34   

This seems like the usual code, then it looks like an issue with on the infragistics grid.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39870
Joined: 17-Aug-2003
# Posted on: 10-Jul-2008 11:42:50   

Though, why don't you just bind the collection through the grid's DataSource property? Or via a BindingSource ? Grids react on ListChanged.Reset, as MS' code also raises that event.

Frans Bouma | Lead developer LLBLGen Pro