[CLOSED] Ungrouped locked datagrid loses row height after databinding

  1. #1

    [CLOSED] Ungrouped locked datagrid loses row height after databinding

    Hi,

    I have the next problem. Ungrouped locked datagrid loses row height after databinding. But if I group the grid, everything works great. You can activate the line "'aktGrid.Store(0).GroupField = "Col2".

    Imports Ext.Net
    
    Public Class grid2
    
        Inherits System.Web.UI.Page
    
        Dim aktGrid As New GridPanel
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Dim aktResourceManager As New ResourceManager
            With aktResourceManager
                .ID = "rm"
                .Theme = Ext.Net.Theme.Neptune
            End With
    
            With aktGrid
    
                .ID = "mwgrid"
                .Width = 700
                .Height = 700
    
                .SelectionModel.Clear()
                .View.Clear()
                .Plugins.Clear()
                .ColumnModel.Columns.Clear()
                .Features.Clear()
                .Store.Clear()
    
                .EnableLocking = True
    
                Dim _Store As New Store
                _Store.ID = "store1"
    
                Dim _Model As New Model
    
                _Model.IDProperty = "Col1"
    
                For i As Integer = 1 To 10
    
    
                    If i = 1 Then
                        _Model.Fields.Add(New ModelField("Col" & i.ToString, ModelFieldType.Int))
                    Else
                        _Model.Fields.Add(New ModelField("Col" & i.ToString, ModelFieldType.String))
                    End If
    
                Next
    
                _Store.Model.Add(_Model)
    
                _Store.DataSource = Me.Data
    
                .Store.Add(_Store)
    
                With .ColumnModel
    
                    For i As Integer = 1 To 10
    
                        Dim _Col As Object
    
                        If i = 1 Then
                            _Col = New NumberColumn
                        Else
                            _Col = New Column
                        End If
    
                        _Col.ID = "Col" & i.ToString
                        _Col.Text = "Col" & i.ToString
                        _Col.DataIndex = "Col" & i.ToString
    
                        If i = 1 Then _Col.Locked = True
    
                        .Columns.Add(_Col)
    
                    Next
    
                End With
    
    
                Dim _RowSelModel As New RowSelectionModel
    
                With _RowSelModel
                    .Mode = SelectionMode.Single
                End With
    
                .SelectionModel.Add(_RowSelModel)
    
                .Features.Add(New Grouping)
    
                Dim _View As New GridView
                _View.StripeRows = True
                _View.TrackOver = True
    
                .View.Add(_View)
    
            End With
    
            Dim _button As New Button("Databind")
            AddHandler _button.DirectEvents.Click.Event, AddressOf Click
            _button.ID = "databind"
    
            Page.FindControl("form1").Controls.Add(aktResourceManager)
            Page.FindControl("form1").Controls.Add(aktGrid)
            Page.FindControl("form1").Controls.Add(_button)
    
            If Not Ext.Net.ExtNet.IsAjaxRequest Then
    
                'aktGrid.Store(0).GroupField = "Col2"
    
                Dim RM As RowSelectionModel = aktGrid.GetSelectionModel
                If RM.SelectedRows.Count = 0 Then
                    RM.SelectedRows.Add(New SelectedRow(5))
                    RM.UpdateSelection()
                End If
    
            End If
    
    
        End Sub
    
        Private Sub Click(sender As Object, e As DirectEventArgs)
    
            aktGrid.Store(0).DataBind()
    
            Dim RM As RowSelectionModel = aktGrid.GetSelectionModel
            If RM.SelectedRows.Count = 0 Then
                RM.SelectedRows.Add(New SelectedRow(5))
                RM.UpdateSelection()
            End If
    
        End Sub
    
    
        Private ReadOnly Property Data As Object()
            Get
    
                Data = New Object() {New Object() {1, "0. Feasibility Study", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {2, "I. Engineering", "test1", "test1<br/>test", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {3, "II. Procurement", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {4, "0. Feasibility Study", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {5, "0. Feasibility Study", "test1<br/>test", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {6, "0. Feasibility Study", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {7, "I. Engineering", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {8, "I. Engineering", "test1<br/>test", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {9, "I. Engineering", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {10, "II. Procurement", "test1", "test1", "test1", "test1", "test1", "test1", "test1", "test1"},
                New Object() {11, "II. Procurement", "test1<br/>test", "test1", "test1", "test1", "test1", "test1", "test1", "test1"}}
    
            End Get
    
        End Property
    
    End Class
    Last edited by fabricio.murta; Jul 08, 2023 at 6:24 PM.
  2. #2
    Hello Gidi!

    Thanks for the report and test case! This really really looks to be closely related to the issue raised in Grouped Datagrid loses selection by DataBind!

    In fact, the very same work around (and by chance perhaps the very same code line) there works here.

    It means, from your test case, it should suffice to add between lines 100 and 101, the following:

    _button.DirectEvents.Click.Success = "App.mwgrid.getView().refresh()"
    So that an extra refresh is called to the view after it releases layout processing that follows the data that came in.

    We've added a reference for this thread to the existing #1877 GitHub issue so that we post a follow-up once we get that fixed in the code.

    Let us know if the workaround is not acceptable and we'll find an alternative that works for you.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi Fabrício, thank you, everything is working great now! Do you maybe have an idea how I can display the label for the grouping over the entire area. If I set ".x-group-hd-container" - "overflow:visible" it doesn't work.

    Thanks very much
    Greetings Gidi
  4. #4
    Hello again, Gidi!

    I'm afraid spanning the group title across the locked and normal view is not supported. Interesting enough, I couldn't find discussions here and in other boards specific to this issue. The very design of grid locking, where the grid is split into two views, makes it so simply overflowing via CSS won't do -- at least as far as my attempts went here.

    The "easy" way to avoid this would be to set the locked column with a value for MinWidth, so that the contents always fit, if that's under control. Other than that, the only way I see this working would be by some extensive work in the related components. If you want us to log an issue and look further for a solution to this issue, please open a dedicated thread on the subject.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Jun 12, 2023, 7:01 PM
  2. [CLOSED] Locked Datagrid loses selection by DataBind
    By gidi in forum 5.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 06, 2023, 4:07 PM
  3. Replies: 2
    Last Post: Apr 15, 2013, 8:46 AM
  4. Calendar loses DOM on refresh
    By Tallmaris in forum 1.x Help
    Replies: 0
    Last Post: Aug 29, 2011, 12:12 PM
  5. Replies: 1
    Last Post: May 14, 2011, 11:51 AM

Posting Permissions