theGrid.DisplayLayout.Bands(0).Summaries.Add(SummaryType.Sum, theColumn).
The summaries at the bottom of the columns show up correctly. The problem I am having is that whenever I check or uncheck a checkbox in a column, the summary total does not update until I leave the cell. Is there a way to programmatically have the Wingrid run its column summary? I can capture the fact that the check box in the cell has changed its value, but can't seem to find how to recalculate the column.
You could force a specific summary to refresh itself through:
theGrid.DisplayLaytout.Bands(0).Summaries("columnKey").Refresh()
I would make sure that the cell's value is actually getting updated when calling this, though, otherwise you might not see any change.
-Matt
I am handling the CellChange event. If I look at e.Cell.Text, it is set to "True" when I check the check box and "False" when I uncheck it.
I am calling theGrid.DisplayLayout.Bands(0).Summaries(e.Cell.Column.Index).Refresh(), but the summary does not update. Does the value of the checkbox take affect before the CellChange event is fired?
No, the value isn't changed at this point. You could call Update() on the cell to do so, I believe.
There does not seem to be an Update method on the cell. There is a Refresh() but that did not seem to do anything. (in the CellChange event, I did e.Cell.Refresh())
I am seeing this same problem in another way. My application has the ability of saving off the DataSet associated with my grid to an XML file. If I check a check box in a cell but do NOT leave the cell, when I save the DataSet, the value for that field is still FALSE. If I click on another cell after checking the checkbox in a cell, then save the DataSet, it recognizes TRUE for the field.
I suppose I could select another cell and the reselect the current cell behind the scenes, but that seems a little clumsy.
OK...forget my last post. The moment I submitted it, I went back and found an UpdateData() method on the grid itself. Now in the CellChange event, after I process what I need to when the check box state changes, I call
theGrid.UpdateData()
and that seems to update the Summary at the bottom of the column as well as keeping the data in synch when I save off the DataSet without leaving the cell.
Matt, I apologize if that is what you were referring to in you last post.
UpdateData works too. Glad it's working for you.