Greetings everyone,
I am currently building a project that requires me to build a grid that represents a timescale in days. I use 3 column levels namely: week (top), days (middle), dayParts (bottom) so that you get this
|Week 1 ||Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday||m|a|e | m|a|e | m|a|e |m|a|e | m|a|e|m|a|e |m|a|e |
(Something like that except the spacing is better ofcourse :P)
This all works perfect fine when you use a row layout and assign columns. See code below.
The performance is just abysmal when I try to create a full year line. I realize that a lot of columns are rearranged but I am hoping there is a way to improve the performance for this action.
Any suggestions ?
Dim counter As Integer = 0 Dim weekCounter As Integer = 0 Dim dayCounter As Integer = 0 Dim dayPartCounter As Integer = 0 Dim visiblePosition As Integer = 0 Dim dayPosition As Integer = 0 Dim band As UltraGridBand = UltraGrid1.DisplayLayout.Bands(0) UltraGrid1.BeginUpdate() For Each dataColumn As UltraDataColumn In _ds.Band.Columns Dim key As String = dataColumn.Key Dim parts As String() = key.Split("_") If parts.Length > 2 Then ' Day part column visiblePosition += 1 band.Columns(counter).Header.VisiblePosition = visiblePosition band.Columns(counter).RowLayoutColumnInfo.OriginX = dayPartCounter * 2 band.Columns(counter).RowLayoutColumnInfo.OriginY = 4 band.Columns(counter).RowLayoutColumnInfo.PreferredCellSize = New System.Drawing.Size(15, 0) band.Columns(counter).RowLayoutColumnInfo.SpanX = 2 band.Columns(counter).RowLayoutColumnInfo.SpanY = 2 band.Columns(counter).MinWidth = 50 band.Columns(counter).Header.Caption = DRPBase.BaseData.dayParts(parts(3)).description Try band.Columns(counter).Header.ToolTipText = DRPBase.DayParts(parts(0) & parts(3)).Day.Starts.ToShortDateString & "( " & ToolDates.TimeFromMinutes(DRPBase.DayParts(parts(0) & parts(3)).DayPart.Starts).ToShortTimeString & " - " & ToolDates.TimeFromMinutes(DRPBase.DayParts(parts(0) & parts(3)).DayPart.Ends).ToShortTimeString & " )" Catch ex As Exception ' Key not found End Try dayPartCounter += 1 Else If parts(0) = "week" Then ' week column band.Columns(counter).RowLayoutColumnInfo.LabelPosition = LabelPosition.LabelOnly band.Columns(counter).RowLayoutColumnInfo.OriginX = (weekCounter * (7 * (_DRPBase.BaseData.dayParts.Count * 2))) band.Columns(counter).RowLayoutColumnInfo.OriginY = 0 band.Columns(counter).RowLayoutColumnInfo.PreferredCellSize = New System.Drawing.Size(331, 0) band.Columns(counter).RowLayoutColumnInfo.SpanX = 7 * (_DRPBase.BaseData.dayParts.Count * 2) band.Columns(counter).RowLayoutColumnInfo.SpanY = 2 Dim list As List(Of Week) = _period.getWeeks(True, True) Dim fourweek As New FourWeekPeriod(list.Item(weekCounter).Starts) band.Columns(counter).Header.Caption = "Week " & parts(1) & " (Periode: " & fourweek.PeriodNumber & ")" weekCounter += 1 Else ' day column visiblePosition += 1 band.Columns(counter).RowLayoutColumnInfo.LabelPosition = Infragistics.Win.UltraWinGrid.LabelPosition.LabelOnly band.Columns(counter).Header.VisiblePosition = visiblePosition band.Columns(counter).RowLayoutColumnInfo.OriginX = dayPosition band.Columns(counter).RowLayoutColumnInfo.OriginY = 2 band.Columns(counter).RowLayoutColumnInfo.PreferredCellSize = New System.Drawing.Size(44, 0) band.Columns(counter).RowLayoutColumnInfo.SpanX = _DRPBase.BaseData.dayParts.Count * 2 band.Columns(counter).RowLayoutColumnInfo.SpanY = 2 band.Columns(counter).Width = 25 band.Columns(counter).Header.Caption = _dagen(ToolDates.DateFromString(parts(1)).DayOfWeek) band.Columns(counter).Header.ToolTipText = parts(1) dayPosition += _DRPBase.BaseData.dayParts.Count * 2 dayCounter += 1 End If End If band.Columns(counter).CellDisplayStyle = CellDisplayStyle.PlainText counter += 1 Next band.UseRowLayout = True UltraGrid1.EndUpdate()
When you say "a full year line", do you mean 52 weeks?
So each week have 7 days and each day has 3 columns. So that's 11 x 52 = 572 columns?
If that's the case, I'm not at all surprised that the performance becomes a problem. that's a huge amount of columns.
Is the performace still bad if you have no rows and just have column headers? Or what if you just have a singe row?
I am wondering if the issue is really the number of columns or if something about those columns may be causing or exascerbating the problem.
Have you tried looking the WinGrid Performance Guide?
Hi,
Thank you for the response. There are indeed that many columns, and it doesn't matter if I have 1 row or 20 rows.
From tests I have noticed that the number of columns isn't an issue. Because if I remove the multiple levels the performance is drastically improved. However this is not an option for me cause I need to have the multiple column levels.
PS: Yes I have also read the performance guide and thus I am using the beginupdate/end update in my code. Although it gives no percievable improvement.
So my guess is that altering the position of the columns and their spans is what is causing the performance to falter.
If it's really the levels that are causing the problem, the I recommend that you create a small sample project demonstrating this and Submit an incident to Infragistics Developer Support.
I can't see any reason why having levels should cause any noticable performance issues. So it sounds to me like something is not right or could be optimized within the grid to make this perform better.