Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
535
Column levels and performance
posted

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()

Parents
  • 469350
    Offline posted

    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?

Reply Children