Formulas and deserialization issue
If you run the attached project, you will notice the following:
1) If you press the button, the value in B5 changes but the value in B2 (which has a formula that references B5) does not refresh until you select a range that includes B2. After you do that, B2''s contents always update when B5''s values changes.
2) If before you press the button, you select a range that includes B2, then when b5 changes, the change is immediately seen in b2 and it stays that way from then on.
This only seems to happen if you deserialize a grid model. If you skip the deserialization, then B2 always refreshes when B5 changes.
So, my question is: After deserialization, how can I get the grid model into the same state as the one induced by selecting a range that includes B2?
Thanks
issue5.zip
issue5.zip
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
March 6, 2006 06:35 AM UTC
Hi Alex,
Try gridModel.Refresh() after changing the values to see if that helps. Below is the code snippet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''Me.GridControl1.Model.Rows.InsertRange(3, 2)
Dim gm As GridModel = Me.GridControl1.Model
..........
............
gm(5, 2).CellValue = 123
gm.Refresh()
End Sub
Regards,
Calvin.
AD
Administrator
Syncfusion Team
March 6, 2006 05:25 PM UTC
Hi Calvin,
Doing a gridmodel.Refresh() does work but since it (i''m assuming) forces a full refresh, it is slow. On a 60row, 20col grid, I can hit the button to change the value and refresh faster than the grid can refresh. If I call gridcontrol.RefreshRange with that one cell range, then it is instantaneous.
My issue only occurs if you deserialize a grid model. If you try this with no deserialization, then it works perfectly. I just want to get the deserialized grid model in the same state as one created from scratch. I also don''t want to deal with special cases regarding wether the gridmodel is deserialized or not.
Let me know your thoughts.
AD
Administrator
Syncfusion Team
March 10, 2006 12:11 PM UTC
Hi Alex,
I apologize for the inconvenience caused. We are looking in to the issue and will get back with a solution soon.
Regards,
Calvin.
AD
Administrator
Syncfusion Team
March 15, 2006 10:09 AM UTC
Hi Alex,
Sorry for the delayed reply. It is a focus issue when a grid with formula cells is de serialized. And the grid needs the focus during the dependent value for a formula cell changes. Just setting the focus to the grid in the button click handler will do. Below is a code snippet.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim gm As GridModel = Me.GridControl1.Model
Me.GridControl1.Focus()
gm(5, 2).CellValue = 123
End Sub
Regards,
Calvin.
AD
Administrator
Syncfusion Team
March 16, 2006 08:03 PM UTC
Hi Calvin,
Thanks for the reply and the solution. It works, except that the gridcontrol.focus call has to be done in the button press event handler and I''m populating the grid in the load event of my form. Fortunately, while tackling another problem, I found that doing the following:
gm = GridModel.LoadBinary("gridmodel.bin")
Me.GridControl1.Model = gm
gm.ActiveGridView = Me.GridControl1
solves the problem even if executed in the Load event handler.
Is setting the active grid view something safe to do or will it cause other problems in your opinion?
SIGN IN To post a reply.
- 5 Replies
- 1 Participant
-
AD Administrator
- Mar 3, 2006 07:26 PM UTC
- Mar 16, 2006 08:03 PM UTC