I am expanding rows to level 1 in my PivotGrid. I put the code in the InitializeRow event of the grid:
If e.Row.IsExpandable AndAlso Not e.Row.Expanded AndAlso Not myFDS.IsAsyncOperationPending AndAlso e.Row.Tuple.Members(e.Row.MemberIndex).Depth = 0 Then myFDS.ExpandAxisTupleMemberAsync(Infragistics.Olap.AxisType.Row, e.Row.TupleIndex, e.Row.MemberIndex, True, upgCube) End If
This works as expected.
The problem is InitializeRow also fires when the user collapses rows and then this code should not execute. I could just have a Boolean that is set when the grid completes rendering and add that to above code. But I cannot find an event, on either the grid or the FlatDataSource, that fires when rendering is complete.
Alternatively I could move above code out of InitializeRow, if that makes sense.
Anybody have a suggestion as how to what the best way here is?
Thanks,
Trausti
Hello and thank you for contacting Infragistics. Rending is an on-going procedure so it really depends on what you are trying to do and when. Please clarify.
What I initially think of is hooking Form Load event, mouse down etc if one of the pivot grid's events aren't enough. You can try calling Invalidate on the pivot grid when you want to execute your code. This should fire the Invalidated event, which as it's explained in our API deals with a redraw.
https://ko.infragistics.com/help/winforms/infragistics.win.ultrawinpivotgrid~infragistics.win.ultrawinpivotgrid.ultrapivotgrid_members#
Hi Michael and thanks for your reply.
I am expanding both my rows and columns automatically when the grid is bound to a FlatDataSource. I don't want to expand all levels, here is an example from the row section where the first level is expanded automatically:
This works as expected. But the user cannot collapse rows as I have my code in InitializeRow of the grid and it fires when users collapse rows and therefore collapsing causes it to expand again.
Current hack was to use a Boolean variable which is set to true when a cell is first activated in the grid. That works, but is not a great solution.
I was looking for some event or property that would indicate when the grid's data has been fully loaded after it being bound to the FlatDataSource. Alternatively I could move my code out of InitializeRow, but I am not sure that is the right thing to do.