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.
Hello Imad,
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.
Looking forward for your reply.
Hi Stefan,
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?
Thanks for your help Stefan, I'll look into it.
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?
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I am still looking for a solution for this. I also tried:
layout.DataPresenter.InitializeRecord += new EventHandler<InitializeRecordEventArgs>(Dg_InitializeRecord);
but didn't work. Might be something in my grid.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.