Hi,
I am refreshing sorting when I add new items in my grid. It works fine when items are not grouped. In case of grouping this refreshing doesn't work or new items are not placed in sorted order. I am refreshing sorting like this:
EventViewDg.Records.RefreshSort();
Any idea how to fix that?
Thanks,
Imad.
Hi Stefan,
I tried the sample. Your solution works fine in sample. In my case I am creating columns in FieldLayoutInitialized event and in my case InitializeRecord doesn't execute at all. I tried following solution mention in another thread (http://blogs.infragistics.com/forums/t/54155.aspx) but no use:
dg.BeginInit();
dg.DataSource = tbl.DefaultView;
dg.EndInit();
Can you point me to any possible reasons that might cause InitializeRecord to not execute?
Thanks for your help Stefan, I'll look into it.
Hello Imad,
I have created a sample project for you, where I implemented the approach I suggested you and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
InitializeRecord event never executes in my case, as I am just adding new row in observablecollection of grid instead of changing any cell in grid.
Here is the explanation of InitializeRecord event from one of the post on infragistics forum:
"When the grid receives a notification that a property on data item changes it will raise the InitializeRecord event where the ReInitialize property of the InitializeRecordEventArgs is set to true. You could listen to the InitializeRecord event and call RefreshSortPosition on the Record."
Any other solution that I can try to sort new items in grid when items are grouped?
Thank you for your post. I have been looking into it and I can suuegst you handle the XamDataGrid’s InitializeRecord event and add the following code in its handler:
e.Record.RefreshSortPosition();
Instead of calling the Records Collection’s RefreshSort method. Please let me know if this helps you or you need further assistance on this matter.