I removed the call to UpdateDetailGrids.
I have now isolated the fact that that including the two detail grids is causing a long delay after the call to EndInit on the master grid.
If I remove the two detail grids the time to execute EndInit is only a few milliseconds. If I include the two detail grids, (with the initial state collapsed) using detail.Collapsed = True property the time to show the grid is about 11.5 seconds!!.
Here is the code for setting up the grid with the detail grids. SetxColProperties is a simple function that just sets some of the common properties list display index, visible,report with and formatting if they are passed in and has no effect on the total time. (I removed it once already with no noticeable impact on the 11.5 seconds.)
Total row count for the master is about 175 rows and the detail grids contain anywhere from 5 rows each to 1100 rows each. The total row count for all the detail grids combined is only 32,000 rows.
LocalGrid.DetailGridTemplates.Clear()
LocalGrid.BeginInit()
LocalGrid.RowSelectorPane.Visible = False
LocalGrid.DataSource = LocalData.ReturnDataset
LocalGrid.DataMember = LocalData.ReturnDataset.Tables(0).TableName
LocalGrid.GroupTemplates.Clear()
LocalGrid.FixedHeaderRows.Clear()
LocalGrid.FixedHeaderRows.Add(New Xceed.Grid.GroupByRow())
LocalGrid.FixedHeaderRows(0).Visible = Me.ctxBinConditionsShowGroupManagerBar.Checked
LocalGrid.FixedHeaderRows.Add(New Xceed.Grid.ColumnManagerRow())
'LocalGrid.ApplyStyleSheet(Xceed.Grid.StyleSheet.TheLargeBlues)
'With this option if you change the sorting or grouping of any of the detail grids it will apply that to all of the detail grids
LocalGrid.SynchronizeDetailGrids = True
'Detail Grid Code-Create the detail grid on if the relationship was created.
If LocalData.ReturnDataset.Relations.Contains("MasterBin_DetailBin") = True Then
Dim detail As New Xceed.Grid.DetailGrid()
Dim TitleRow As New Xceed.Grid.TextRow
TitleRow.Text = "Best Wafers"
detail.Title = "Best Wafers"
detail.HeaderRows.Add(TitleRow)
detail.HeaderRows.Add(New Xceed.Grid.ColumnManagerRow())
detail.ApplyStyleSheet(Xceed.Grid.StyleSheet.Xceed)
detail.Collapsed = True
detail.ReportStyle.Visible = False
Dim xDetailColumn As Xceed.Grid.DataBoundColumn
Dim ColName As String = ""
detail.AutoCreateColumns = False
For Each oCol As DataColumn In LocalData.ReturnDataset.Tables(1).Columns
ColName = oCol.ColumnName
If (ColName <> "Diameter") AndAlso _
(ColName <> "Substrate") AndAlso _
(ColName <> "Material_Category") AndAlso _
(ColName <> "Bin") AndAlso _
(ColName <> "Priority") Then
xDetailColumn = New Xceed.Grid.DataBoundColumn(oCol.ColumnName)
detail.Columns.Add(xDetailColumn)
End If
Next
SetxColProperties(detail.Columns("LotID"), 0, 104)
SetxColProperties(detail.Columns("RunID"), 1, 104)
SetxColProperties(detail.Columns("YD_PercentVf"), 2, 104, "P")
SetxColProperties(detail.Columns("PassingYield"), 3, 104, "P")
SetxColProperties(detail.Columns("PreferredYield"), 4, 104, "P")
SetxColProperties(detail.Columns("ReservationYield"), 5, 104, "P")
SetxColProperties(detail.Columns("PriorityFactor"), 6, 104)
SetxColProperties(detail.Columns("PAvg_Wave_Percent"), 7, 104, "P")
SetxColProperties(detail.Columns("PAvg_Int_Percent"), 8, 104, "P")
SetxColProperties(detail.Columns("MaterialName"), 9, 104)
SetxColProperties(detail.Columns("HoldingLetter"), 10, 104)
SetxColProperties(detail.Columns("HoldingNumber"), 11, 104)
detail.Columns("TestingBin").Visible = False
AddHandler detail.CollapsedChanged, AddressOf BinTestDetailColapsedChanged
AddHandler detail.AddingDataRow, AddressOf BinTestingRowHighlight
detail.DataSource = Nothing
detail.DataMember = "MasterBin_DetailBin"
LocalGrid.DetailGridTemplates.Add(detail)
End If
If LocalData.ReturnDataset.Relations.Contains("DetailBin_SubDetailBin") = True Then
Dim SubDetail As New Xceed.Grid.DetailGrid()
Dim SubTitleRow As New Xceed.Grid.TextRow
SubDetail.Title = "Alternate Wafers"
SubTitleRow.Text = "Alternate Wafers"
SubDetail.HeaderRows.Add(SubTitleRow)
SubDetail.HeaderRows.Add(New Xceed.Grid.ColumnManagerRow())
SubDetail.ApplyStyleSheet(Xceed.Grid.StyleSheet.Xceed)
SubDetail.Collapsed = True
SubDetail.ReportStyle.Visible = False
Dim xColumn As Xceed.Grid.DataBoundColumn
Dim ColName As String = ""
SubDetail.AutoCreateColumns = False
For Each oCol As DataColumn In LocalData.ReturnDataset.Tables(2).Columns
ColName = oCol.ColumnName
If (ColName <> "Diameter") AndAlso _
(ColName <> "Substrate") AndAlso _
(ColName <> "Material_Category") AndAlso _
(ColName <> "Bin") AndAlso _
(ColName <> "Priority") Then
xColumn = New Xceed.Grid.DataBoundColumn(oCol.ColumnName)
SubDetail.Columns.Add(xColumn)
End If
Next
SetxColProperties(SubDetail.Columns("LotID"), 0, 104)
SetxColProperties(SubDetail.Columns("RunID"), 1, 104)
SetxColProperties(SubDetail.Columns("YD_PercentVf"), 2, 104, "P")
SetxColProperties(SubDetail.Columns("PassingYield"), 3, 104, "P")
SetxColProperties(SubDetail.Columns("PreferredYield"), 4, 104, "P")
SetxColProperties(SubDetail.Columns("ReservationYield"), 5, 104, "P")
SetxColProperties(SubDetail.Columns("PriorityFactor"), 6, 104)
SetxColProperties(SubDetail.Columns("MaterialName"), 7, 104)
SetxColProperties(SubDetail.Columns("HoldingLetter"), 8, 104)
SetxColProperties(SubDetail.Columns("HoldingNumber"), 9, 104)
SubDetail.Columns("TestingBin").Visible = False
AddHandler SubDetail.CollapsedChanged, AddressOf BinTestDetailColapsedChanged
AddHandler SubDetail.AddingDataRow, AddressOf BinTestingRowHighlight
SubDetail.DataSource = Nothing
SubDetail.DataMember = "DetailBin_SubDetailBin"
LocalGrid.DetailGridTemplates.Add(SubDetail)
End If
LocalGrid.Columns("TestingBin").Visible = False
SetxColProperties(LocalGrid.Columns("Diameter"), 0, 50, "", False, Xceed.Grid.SortDirection.None, "Diameter", False)
AdjustXceedColumnWidth(LocalGrid, "Diameter", "Diameter")
LocalGrid.Columns("Substrate").VisibleIndex = 1
LocalGrid.Columns("Substrate").Title = "Substrate"
LocalGrid.Columns("Substrate").ReportStyle.Width = 50
LocalGrid.Columns("Material_Category").VisibleIndex = 2
LocalGrid.Columns("Material_Category").Title = "Material"
LocalGrid.Columns("Material_Category").ReportStyle.Width = 140
LocalGrid.Columns("Priority").VisibleIndex = 3
LocalGrid.Columns("Priority").ReportStyle.Width = 80
LocalGrid.Columns("Bin").VisibleIndex = 4
LocalGrid.Columns("Bin").ReportStyle.Width = 120
LocalGrid.Columns("Bin").SortDirection = Xceed.Grid.SortDirection.Ascending
LocalGrid.Columns("BestBinLotCount").VisibleIndex = 5
LocalGrid.Columns("BestBinLotCount").Title = "Best Bin Count"
LocalGrid.Columns("BestBinLotCount").ReportStyle.Width = 70
AdjustXceedColumnWidth(LocalGrid, "BestBinLotCount", "Best Bin Count")
LocalGrid.Columns("AltBinLotCount").VisibleIndex = 6
LocalGrid.Columns("AltBinLotCount").Title = "Alt Bin Count"
LocalGrid.Columns("AltBinLotCount").ReportStyle.Width = 70
AdjustXceedColumnWidth(LocalGrid, "AltBinLotCount", "Alt Bin Count")
LocalGrid.Columns("BestBinAvg_YD_PercentVf").VisibleIndex = 7
LocalGrid.Columns("BestBinAvg_YD_PercentVf").FormatSpecifier = "P"
LocalGrid.Columns("BestBinAvg_YD_PercentVf").Title = "AVG Yield"
LocalGrid.Columns("BestBinAvg_YD_PercentVf").ReportStyle.Width = 104
LocalGrid.Columns("PassingYield").VisibleIndex = 8
LocalGrid.Columns("PassingYield").FormatSpecifier = "P"
LocalGrid.Columns("PassingYield").Title = "Pass Yield"
LocalGrid.Columns("PassingYield").ReportStyle.Width = 104
LocalGrid.Columns("PreferredYield").VisibleIndex = 9
LocalGrid.Columns("PreferredYield").FormatSpecifier = "P"
LocalGrid.Columns("PreferredYield").Title = "Hold Yield"
LocalGrid.Columns("PreferredYield").ReportStyle.Width = 104
LocalGrid.Columns("ReservationYield").VisibleIndex = 10
LocalGrid.Columns("ReservationYield").FormatSpecifier = "P"
LocalGrid.Columns("ReservationYield").Title = "Res Yield"
LocalGrid.Columns("ReservationYield").ReportStyle.Width = 104
LocalGrid.Columns("PriorityFactor").VisibleIndex = 11
LocalGrid.Columns("PriorityFactor").Title = "PF"
LocalGrid.Columns("PriorityFactor").ReportStyle.Width = 40
SetxColProperties(LocalGrid.Columns("WIPDate"), -1, 50, "G", False, Xceed.Grid.SortDirection.None, "WIPDate", False)
AdjustXceedColumnWidth(LocalGrid, "WIPDate", "2008/12/30 12:12:12 PM ")
LocalGrid.GroupTemplates.Add(New Xceed.Grid.Group("Diameter"))
LocalGrid.GroupTemplates.Add(New Xceed.Grid.Group("Substrate"))
LocalGrid.GroupTemplates.Add(New Xceed.Grid.Group("Material_Category"))
I start timing here
LocalGrid.EndInit()
I end timing here
If I remove all the detail grid code and just leave the main grid code the time after the call to EndInit is a few miliseconds, but with the detail grid code in place the time ends up being 11.5 seconds.
This seems like a lot of time to load at most 30,000 rows. I know in the past I have loaded 250,000+ rows in a single master grid in less time.
How can I make the detail grids faster?
Brian