Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4040
InvalidateData() and ActiveCell (after publish)
posted

Hi,

In a grid, some column are grouped (FirstName for example).
When a binded item is updated, we are using InvalidateData() to have the groups refreshed in the grid.

Code sample :

MessageBox.Show("ActiveCell before : " + this.ActiveCell)
this.InvalidateData();
MessageBox.Show("ActiveCell after : " + this.ActiveCell);


Problem 1- ActiveCell lost :

On developpers computers, ActiveCell is still intact after InvalidateData() (run using Visualstudio).
But when application is published on a server (run using IIS), ActiveCell is lost after calling InvalidateData()..

We already had a look on which references have "Local Copy" to True, but with no luck.

Do you know what could be wrong ?

 

Problem 2 - Saving ActiveCell

We would like to save ActiveCell before call to InvalidateData() and restore it after.
We tried like that, but get NullException on restoring :

CellBase cb = this.ActiveCell;
this.InvalidateData();
this.ActiveCell = cb;

Do you know how to do it ?

Regards.

Alain.

Parents
  • 4475
    posted

    Hello Cosoluce_Stones,

     

    I have been looking into your scenario and I was not able to reproduce it locally, since as you mentioned the issue occurs only when you are testing on your servers.

     

    I notice that you are accessing the properties using the “this” keyword. Perhaps you can try replacing it with the grid’s name instead. Also it would be helpful if you give me an additional explanation on when is this code being invoked – is it possible to be too early for the active cell to be initialized, for example in the grid’s initialize event, when the active cell is still null. Perhaps you can try placing you code in a dispatcher and slow its execution down.

     

     Another thing is the null reference exception. Perhaps you can place a check if the active cell is null before the execution of the mentioned code, or even better – try saving the cell’s row index and column key, instead of the cell’s reference, since after the update it is possible that your data has been changed and there is no such cell in the grid any more:

     

    if (xamGrid1.ActiveCell != null)

                {

                    int index = xamGrid1.ActiveCell.Row.Index;                string key = xamGrid1.ActiveCell.Column.Key;                xamGrid1.InvalidateData(); 

                    xamGrid1.ActiveCell = xamGrid1.Rows[index].Cells[(xamGrid1.Columns[key]) as Column];

                }

     

    Please try the given approaches and in case of the issue still stands, contact me and perhaps include some sample project that illustrates the undesired behavior.

     

    If you need any other assistance please feel free to let us know.

     

    Sincerely,

    Ekaterina

    Developer Support Engineer

    Infragistics, Inc.

    www.infragistics.com/support

     

Reply Children
No Data