[CLOSED] Add Columns to GridPanel. Server side

  1. #1

    [CLOSED] Add Columns to GridPanel. Server side

    I add columns to a gridpanel in server side:

    doc.Load(Server.MapPath("Puestos.xml"))
            Dim contador As Integer = 0
            Dim ID As String = "", Texto As String = ""
                For Each nodoCampo As XmlNode In nodo.SelectNodes("control")
                        ID = nodoCampo.Attributes("id").Value
                        Texto = nodoCampo.Attributes("label").Value
                        Dim field As New ModelField("col" & ID, ModelFieldType.String)
                        StoreMatchSol.AddField(field, contador + 10)
                        StoreMatchSol.Model(0).Fields.Insert(contador + 10, field)
    
                        Dim col As New Column
                        col.ID = "col" & ID
                        col.Text = Texto
                        col.Width = "100"
                        col.AutoHeight = True
                        col.DataIndex = "col" & ID
                        col.Align = Alignment.Center
    
                        GridPanelMatch.AddColumn(col)
    
                        contador += 1
                Next
    When I add a few columns the page loads fast but I need to add like 70 columns to the grid and if I do it the page takes more than a minute to load, is there a way of make it faster??
    Last edited by Daniil; Nov 05, 2012 at 3:32 PM. Reason: [CLOSED]
  2. #2
    How many records do you load to the store?
  3. #3
    When you call posted code? During ajax request or inital page load?
    If during initial page load then you have to use
    grid.ColumnModel.Columns.Add(...);
    instead
    grid.AddColumn(...);
    AddColumn must be used during ajax request only (dynamic column adding to rendered grid)
  4. #4
    I'm not loading records yet, because just adding columns it's too slow.

    I call posted code during ajax request when the gridpanel is already rendered.

    Should I build the entire grid in code behind so I can use grid.ColumnModel.Columns.Add(...); ?? Is it faster to load?
  5. #5
    try to pass false as second argument (prevent update layout) for all columns except last, for last column pass true
    GridPanelMatch.AddColumn(col, false)
  6. #6
    I tried it and it's still loading slow.

    Now I'm proving with

    grid.ColumnModel.Columns.Add(...)
    And it loads fast! But I have to use

    Panel.UpdateContent()
    Panel is the container of my grid, but updatecontent fires an error when I put the Locked property in one of the static columns:

    <ext:Column ID="C1" runat ="server" Resizable="false" header="Nombre" DataIndex="Nombre" Width ="170" Locked="true" />
    The error message is: "Can not get property value 'un': object is null or undefined"

    Why is this happening?
  7. #7
    Is there an alternative to solve this?
  8. #8
    Alternative is rerender GridPanel (in this case, do not use AddColumn/AddField, add columns and field directly to own collections)
    GridPanel1.Render();

Similar Threads

  1. [CLOSED] Get visible GridPanel columns from server side
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 20, 2013, 12:22 AM
  2. GridPanel Cell Value at Server Side
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 1
    Last Post: Sep 29, 2010, 3:01 PM
  3. Replies: 0
    Last Post: Sep 20, 2010, 11:45 AM
  4. Save the GridPanel Server Side
    By egodoy in forum 1.x Help
    Replies: 0
    Last Post: May 27, 2009, 1:17 PM
  5. Cannot add gridpanel columns on server side
    By cmschick in forum 1.x Help
    Replies: 2
    Last Post: Feb 16, 2009, 7:19 AM

Posting Permissions