[CLOSED] Gridpanel columns move with locked = true

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Gridpanel columns move with locked = true

    Hi,
    on loading page I need to move column programmatically.
    The code that I use is this

    grid.ColumnModel.Move(0, 10)
    (move columns with index 0 to position 10)

    all work fine, but if in my page there is one or more columns with Locked="True"
    I get this error

    You have to set widget's ID to call its methods (widget - Ext.Net.GridHeaderContainer)
    System.Exception: You have to set widget's ID to call its methods (widget - Ext.Net.GridHeaderContainer)


    The problem occours every time that I move a locked column or a non locked column.
    Is there a smart solution?

    I've tryed to set all columns to Locked="False", move, and reset it to Locked="True" but the new error is this

    Uncaught TypeError: Cannot read property 'move' of undefined

    Thanks in advance
    Polo
    Last edited by Daniil; Aug 12, 2014 at 3:26 PM. Reason: [CLOSED]
  2. #2
    Hi @PoloTheMonk,

    Yes, it might be a problematic scenario, because there are two ColumnModels in a locking GridPanel.

    As far as I can understand you need a certain order of columns at the initial load. So, the best solution is to manage a ColumnModel's Columns collection directly.
  3. #3
    Hi @Daniil,
    I paste here a test page.
    When you run it the message is "You have to set widget's ID to call its methods"
    How can I do?
    Thanks
    Polo

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %>
    <%
        gridTest.ColumnModel.Move(0, 1)
    %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>test moving columns</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="gridTest" runat="server" Title="Test moving" Border="true">
                <Store>
                    <ext:Store ID="StoreInterventi" runat="server" RemoteFilter="true" AutoLoad="false">
                        <Model>
                            <ext:Model ID="ModelTest" runat="server">
                                <Fields>
                                       <ext:ModelField Name="LOCK1" Type="String"></ext:ModelField>
                                       <ext:ModelField Name="LOCK2" Type="String"></ext:ModelField>
                                       <ext:ModelField Name="LOCK3" Type="String"></ext:ModelField>
                                       <ext:ModelField Name="FREE1" Type="String"></ext:ModelField>
                                       <ext:ModelField Name="FREE2" Type="String"></ext:ModelField>
                                       <ext:ModelField Name="FREE3" Type="String"></ext:ModelField>
                                    </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModelTest" runat="server">
                    <Columns>
                        <ext:Column runat="server" ID="Lock1" DataIndex="LOCK1" Width="150" Text="LOCK1" Align="Left" Locked="true" Hideable="false" Sortable="true"></ext:Column>
                        <ext:Column runat="server" ID="Lock2" DataIndex="LOCK2" Width="150" Text="LOCK2" Align="Left" Locked="true" Hideable="false" Sortable="true"></ext:Column>
                        <ext:Column runat="server" ID="Lock3" DataIndex="LOCK3" Width="150" Text="LOCK3" Align="Left" Locked="true" Hideable="false" Sortable="true"></ext:Column>
                        <ext:Column runat="server" ID="Free1" DataIndex="FREE1" Width="150" Text="FREE1" Align="Left" Sortable="true"></ext:Column>
                        <ext:Column runat="server" ID="Free2" DataIndex="FREE2" Width="150" Text="FREE2" Align="Left" Sortable="true"></ext:Column>
                        <ext:Column runat="server" ID="Free3" DataIndex="FREE3" Width="150" Text="FREE3" Align="Left" Sortable="true"></ext:Column>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  4. #4
    Yes, I've reproduced that.

    Please clarify have you tried this?
    So, the best solution is to manage a ColumnModel's Columns collection directly.
  5. #5
    Hi,
    but how can I try this?
    In my page I have only one ColumnModel...
    Thanks!
  6. #6
    Sorry, I don't quite understand you.

    You have a ColumnModel and, respectively, its Columns collection.
    gridTest.ColumnModel.Columns
  7. #7
    Well, but what can I do with this?

    For Each c In gridTest.ColumnModel.Columns
         c.???
    Next
    Is there another method to move columns?
    Thank you
  8. #8
    I'm sorry @Daniil,
    but I can't understand how to use this

    gridTest.ColumnModel.Columns
    thanks in advance
    Polo
  9. #9
    I,
    I've tried with this

        Dim cL As List(Of ColumnBase) = New List(Of ColumnBase)
        For Each c As ColumnBase In gridTest.ColumnModel.Columns.OrderByDescending(Function(q) q.DataIndex)
            Dim col As ColumnBase = New Column
            col.ID = c.ID
            col.DataIndex = c.DataIndex
            col.Text = c.Text
            col.Locked = False
            cL.Add(col)
        Next
        gridTest.Reconfigure(cL)
        gridTest.ColumnModel.Move(0, 1)
    but it doesn't work, always the same error
    Thanks
  10. #10
    I meant this:
    var columns = this.GridPanel1.ColumnModel.Columns;
    var col = columns[0];
    
    columns.RemoveAt(0);
    columns.Insert(1, col);
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] gridpanel Locked="true"
    By gs_user in forum 2.x Premium Help
    Replies: 3
    Last Post: Aug 08, 2013, 12:12 AM
  2. [CLOSED] how can i set TreePanel TreeColumn locked=true
    By UT007 in forum 2.x Premium Help
    Replies: 3
    Last Post: May 17, 2013, 3:32 PM
  3. Replies: 3
    Last Post: Feb 15, 2013, 3:49 AM
  4. Replies: 1
    Last Post: Feb 15, 2013, 3:19 AM
  5. Replies: 1
    Last Post: May 12, 2010, 4:41 PM

Tags for this Thread

Posting Permissions