Hi,
We have a number of grids that have formulas that calculate a total cost. (Quantity * Cost).
They work great in every case except one:
In the work completed method of a background worker we have a refresh of the grids with the data adapter by clearing the rows then filling.
table.Rows.Clear();
adapter.Fill(table);
Before this happens we suspend the calcmanager, then resume right after.
ucManager.SuspendCalc();
//refresh grid
ucManager.ResumeCalc();
ucManager.ReCalc();
The cells for the grid which are the formula though are blank.
As a test I put in the AfterExitEditMode event the same lines:
Once you click in a cell then out the values all come back:
I read here
https://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/html/Infragistics4.Win.UltraWinCalcManager.v12.2~Infragistics.Win.UltraWinCalcManager.UltraCalcManager~SuspendCalc.html
that suspend stacks so you need to call the same # of recalcs. I made sure that Suspend is only called once in the above example.
I feel like I am missing something simple. What do you think?
Thanks,M.
Hello Michael,
I have been investigating into the behavior you are reporting, but after creating a sample project based on the code you have provided, I cannot seem to reproduce it. One thing I am curious about in this case is whether or not you may have DeferredCalculationsEnabled set to “True.” If so, something you may be able to try to get around this is to set this property to “False.”
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 20.1.20201.42 in Infragistics for Windows Forms 2020 Volume 1.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if you have any other questions or concerns on this matter.
UltraGridCalcManDemo.zip
Great news your suggestion for DeferredCalculationsEnabled did the trick. Seems like the problem is solved.
Thanks,
M.
Thank you for your update(s) on this matter.
It would definitely be more helpful if you can give us details specifically on the UltraGrid that this is happening on rather than the entirety of the application that you are currently working on. This would allow us to be able to find that this issue is indeed an issue specifically with the UltraGrid and not something specific to your application.
I would be curious to know what would happen if you apply the settings that you currently have applied to your UltraGrid in your application in the sample project I originally sent you. Then, if this reproduces the behavior you are seeing, please send the sample project back so that we can reproduce the behaviors locally.
I would also be curious to know what the specific version of Infragistics for Windows Forms you are testing against, as a change in the version that you are targeting could certainly have an effect here as well.
Interesting thank you Mike. I would have to work on creating a sample as what we have is a rather large product. I could give you the entire project and the database but it is probably a gig or two. If I put it on dropbox and give you a link does that work?
If that solves the problem for you, that's great. But I'm not sure it does because setting that property has a lot of other implications that you might not want. Basically, what that property does is it tells the grid to calculate the cells that are in view first, and defer the ones that are out of view. So turning it off means that the CalcManager will calculated the cells in the grid that are scrolled out of view even while they are scrolled out of view. And that can cause the cells that are IN view to not be calculated immediately and also it could create performance problems for your application. If you only have a few rows in your grid, then it's probably okay, but if you have a lot of rows, then that's probably not a good solution for you. But it does tell us that the reason the cells are not being recalculated immediately has something to do with the deferring of the calculations. There's probably something wrong there, like the grid isn't notifying the calc manager that a bunch of new rows have just been displayed. So if you can give us a sample the reproduces the error, it's something we should really look into.