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
260
Grid Columns Not retaining wdith when clearing Group
posted

We've recently upgraded to the verion 10.2.20102.1004. I have a grid in which a single group is created in the gird. When this grid initially loads and is populated it displays as expected, but when the underlying data set is reset and the Group is cleared the columns are not retainging thier widths. Please note that the gird is created dynamicly at runtime. Thre were no such issues in version 3.1.20041.1044, but we're getting the anomaly since upgrading. Any ideas? Here's a sample of the code that worked in the older version, perhaps I need to do something else to retain the column widths. Unable to find anything on your site regading this sort of behavior, please advice.

 

Private Sub PopDetailGrid()
        With grdDetail
            .SuspendLayout()
            .DisplayLayout.Bands(0).Groups.Clear()
            NewgrdDetail.PopGridData(rsGLTransdata)

            If (_columWidths.Count = 0) Then
                SetDetailColumnWidths()
            End If

            With .DisplayLayout.Bands(0)

                ' Add a group with the key of G1
                .Groups.Add("G1")
                .LevelCount = 2
                .GroupHeadersVisible = False
                .Groups("G1").Columns.Add(.Columns("GLAccount"))
                .Groups("G1").Columns.Add(.Columns("GLPeriod"))
                .Groups("G1").Columns.Add(.Columns("ActivityPeriod"))
                .Groups("G1").Columns.Add(.Columns("Batch"))
                .Groups("G1").Columns.Add(.Columns("TransType"))
                .Groups("G1").Columns.Add(.Columns("TransDate"))
                .Groups("G1").Columns.Add(.Columns("TransRef"))
                .Groups("G1").Columns.Add(.Columns("Agreement"))
                .Groups("G1").Columns.Add(.Columns("Company"))
                .Groups("G1").Columns.Add(.Columns("TransAmount"))
                .Groups("G1").Columns.Add(.Columns("TransDescr"))
                .Columns("TransDescr").Level = 1
                .Override.CellAppearance.BackColor = Color.White
                .Override.RowFilterMode = RowFilterMode.AllRowsInBand
                .Columns("TransDescr").Header.Caption = ""
                Dim cCol As UltraGridColumn = .Columns("TransAmount")
                .Summaries.Clear()
                Dim sSum As SummarySettings
                sSum = .Summaries.Add("avgTransAmount", SummaryType.Average, cCol, SummaryPosition.Left)
                With sSum
                    .Appearance.BackColor = Color.LightBlue
                    .DisplayFormat = "{0:Transaction Average: $#,###.00}"
                    .SummaryPosition = SummaryPosition.Right
                    .Appearance.TextHAlign = HAlign.Right
                    .Hidden = True
                End With
                sSum = .Summaries.Add("sumTransAmount", SummaryType.Sum, cCol, SummaryPosition.Right)
                With sSum
                    .Appearance.BackColor = Color.LightBlue
                    .DisplayFormat = "{0:Transaction Total: $#,###.00}"
                    .SummaryPosition = SummaryPosition.Right
                    .Appearance.TextHAlign = HAlign.Right
                    .Hidden = True
                End With
            End With
            UpdateTotalLabel()
            SetGrid(grdDetail)
            SetGridLines(grdDetail)
            .DisplayLayout.Scrollbars = UltraWinGrid.Scrollbars.Vertical
            .ActiveRow = Nothing
            .FlatMode = True
            .BringToFront()
            .ResumeLayout()
        End With
        lblRecordCount.Text = Format(Me.grdDetail.Rows.VisibleRowCount, "#,##0") _
                            & " records visible of " & Format(Me.grdDetail.Rows.Count, "#,##0") _
                            & " records retrieved out of " & Format(rsGLTransdata.Count, "#,##0") _
                            & " records for the selected GL Periods."
    End Sub

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    What do you mean by "when the underlying data set is reset"? If you are doing something to the data source that is causing a Reset notification, then the grid will lose it's layout. It has no choice but to do this and I don't see how this could have been different in any other version. Although version 3 is so old, it's possible there was something else going on in that version.

    It looks to me like that code you have here is explicitly setting the columns widths. At least I assume that's what the SetDetailColumnWidths method does. I can only guess by the name since you did not include the method code here.

    It's really hard to tell anything much from a code snippet like this, since I don't know what half of the method calls do and I don't know when this code is getting called.

     

Children