On my grid form, i display a statusbar with the number of records displayed. To accomplish this i use the this.ultraGrid1.Rows.Count property after every operation (row deleting, inserting, etc.). This is fine when rows are displlayed but i cannot determine how many rows are shown when i use the Outlook groupby functionality. For example, suppose i have a grid of tax rates per zipcode for each state. when i display the grid initially i get all rows and the count, which is fine. When the user drags the state to the groupby area i would like the count to show 50, indicating 50 states. When a state is expanded it should show the number of zipcodes for that state.
My problem is that i cannot find any events that are fired when the grid is grouped. Is there any way to accomplish what i am looking for?
Try the InitializeGroupByRow event and a boolean ex: boolGridIsGroupedBy. This event is fired when each of the GroupByRow's are initialized.
You could restrict it like this:
If boolGridIsGroupedBy=false then
boolGridIsGroupedBy=true
end if
Otherwise you try to set the boolean to true every time a group row is made.
I'm not sure how InitializeGroupByRow would help. You really can't count the rows in an Initialize event - the event may fire more than once for the same row or not fire at all for rows that are not in view. So that would be a very unreliable method.
There's really no easy way to get a count of regular rows like this, because the grid does not keep any such count. You would really have to recursively loop through the grid rows and count them yourself to make this completely reliable.