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
The UltraPivotGrid needs a Before/AfterRowExpanded and collapsed events.
I recommend submitting a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at https://es.infragistics.com/community/ideas.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.- Notifications whenever new information regarding your idea becomes available.- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.- Allow you to shape the future of our products by requesting new controls and products altogether.- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at https://es.infragistics.com/community/ideas (creating a new login if needed).2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)3. Add your product idea and be sure to be specific and provide as much detail as possible.The Product Idea site puts you in the driver's seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Both of those events are firing throughout the live of the grid, including when the user collapses and expands rows. I put in a timer and the code I have in InitializeRow and InitializeColumn is only executed for the first 5 seconds after the data is set. There is probably a better way to achieve this, but I can leave it at this.
I can see this is always going to be tricky. Expanding rows in code causes the grid to refresh data. Maybe a better approach is to not do this auto-expansion on Initialize row, but rather iterate the rows after the grid is bound. But that seems tricky too because the data source is in a middle of async operation right after binding the grid.
The FlatDataSource has a DataSourceChanging/Changed event that might help if the Invalidate approach above doesn't work.
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.
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://es.infragistics.com/help/winforms/infragistics.win.ultrawinpivotgrid~infragistics.win.ultrawinpivotgrid.ultrapivotgrid_members#