I have a problem with Expanding the DataRows. If I preload all of the data there is no problem. However, I can't do that.
What I do is when a user clicks the expand I capture that in the before row expanded. Then I update my DataSource with the new structure including the child elements. The plus disappears, but the rows do not show. The rows are there and if I click off the row and back on it they are there.
Thanks in advance for any help.
altja said:I do not see the WinGrid samples explorer I looked all over the place. Can you give me a link?
The samples are not installed with NetAdvantage by default, they are in a separate installer for the NetAdvantage SDK. You should be able to download it here: My Infragistics Keys and Downloads - Download Anything and Everything You Own
This is the full solution that I implemented. Thanks Mike. I had to combine what you said and part of what I was doing. I was a little quick to jump the gun. Thanks again.
private void ugCustomer_BeforeRowExpanded(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { System.Console.WriteLine(e.ToString() + "ugCustomer_BeforeRowExpanded"); Infragistics.Win.UltraWinGrid.UltraGridRow r = e.Row;
if (r.Band.Key.Equals("List`1")) { if (r.ChildBands[0].Rows.Count < 1) { _helper.Customers = _customer.AddSites(_helper.Customers, (int)r.Cells[1].Value); r.Activate(); CaptureTreeLevel(e.Row); }
} else if (r.Band.Key.Equals("Sites")) { if (r.ChildBands[0].Rows.Count < 1) { _helper.Customers = _customer.AddProjects(_helper.Customers, (int)r.Cells[1].Value); r.Activate(); CaptureTreeLevel(e.Row); }
} else if (r.Band.Key.Equals("Projects")) {
} }
private void ugCustomer_AfterRowActivate(object sender, EventArgs e) { ugCustomer.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.ReloadData); }
I do not see the WinGrid samples explorer I looked all over the place. Can you give me a link?
Is there a different control that i can use to display the data that you would recommend.
I have the latest hotfix. My winGrid is 8.3.20083.2039.
Refreshing the Grid did not work.
ugCustomer.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.ReloadData);ugCustomer.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay);
AfterRowActivate is never called. See the order below.
Infragistics.Win.UltraWinGrid.CancelableRowEventArgsugCustomer_BeforeRowExpandedInfragistics.Win.UltraWinGrid.InitializeRowsCollectionEventArgsugCustomer_InitializeRowsCollectionInfragistics.Win.UltraWinGrid.InitializeRowsCollectionEventArgsugCustomer_InitializeRowsCollectionInfragistics.Win.UltraWinGrid.RowEventArgsugCustomer_AfterRowExpandedSystem.Windows.Forms.MouseEventArgsugCustomer_MouseDownSystem.Windows.Forms.MouseEventArgsugCustomer_ClickSystem.Windows.Forms.MouseEventArgsugCustomer_MouseClickSystem.Windows.Forms.MouseEventArgsugCustomer_MouseUp
The WinGrid isn't really designed to load child rows on-demand like this. It should work, but it may be some sort of timing problem.
The first thing I recommend is that you get the latest Hot Fix. There were some updating issues like this that were fixed.
If that doesn't help, then after you add the rows the to data source, try calling grid.Rows.Refresh(ReloadData).
Another option might be to try using the AfterRowActivate event instead of BeforeRowExpanded. This would obviously be less efficient, but it might work better.
If you want to load the grid data on-demand, you should check out the Virtual Mode sample in the WinGrid samples explorer.This is the recommended way to load the grid on-demand.
If none of that helps, I recommend that you Submit an incident to Infragistics Developer Support and include a small sample project demonstrating the issue so they can check it out.
When I look at the DataSource it is correct. When I look at the actual Row it says that it does not have children. For some reason activating it seems to make childrows with more than one row work. However a single row does not expand still.
private void ugCustomer_BeforeRowExpanded(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { Infragistics.Win.UltraWinGrid.UltraGridRow r = e.Row;
if (r.Band.Key.Equals("List`1")) //r.Band.Key.Equals("DataBindingList`1") || { if (r.ChildBands[0].Rows.Count < 1) { _helper.Customers = _customer.AddSites(_helper.Customers, (int)r.Cells[1].Value);
//ugCustomer.DataSource = _helper.Customers; r.Activate(); //if (r.HasChild())