[CLOSED] 2.x Hide Grid columns on client side

  1. #1

    [CLOSED] 2.x Hide Grid columns on client side

    Hi,

    How can I hide column on client side, when I click a button?

    this code works well in EXT.NET 1.0

    if (#{grid1}.getColumnModel().isHidden(6))
    {
        #{grid1}.getColumnModel().setHidden(6, false); 
    }
    but does not work in version Ext.NET 2.0. Any help?

    Thanks in advance
    Last edited by Daniil; Sep 06, 2012 at 2:44 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    We are glad to see you on the Ext.NET forums!

    The problem is related to the CHANGELOG items #12 and #18.

    12. Column .ColumnID has been renamed to .ID

    Now Column is a component and registered in ComponentMgr (http://www.sencha.com/forum/showthread.php?133562)

    Example

    //Old <ext:Column ColumnID="company">

    //New <ext:Column ID="company" runat="server">
    18. ColumnModel .SetHidden() has been removed.

    Use Column .Hidden

    Example

    //Old this.GridPanel1.ColumnModel.SetHidden(2, true);

    //New this.GridPanel1.ColumnModel.Columns[2].Hidden = true;
    The CHANGELOG is online:
    http://examples2.ext.net/#/Getting_S...nts/CHANGELOG/
    and in the sources.

    The above CHANGELOG items means that you can the following.

    1. Specify an ID for the Column, for example, "Column1" and call just:
    App.Column1.hide();
    2. If you need to access a Column by index, please use this code:
    App.GridPanel1.columns[index].hide();

    My best thoughts regarding migration from v1 to v2 are here:
    http://forums.ext.net/showthread.php...ll=1#post79239
  3. #3
    Thank you Daniil,

    Please mark the issue is resolved.

    I have applied the following code which is work in EXT.NET 2.x

    if (App.grid1.columns[6].isHidden()) { 
          App.grid1.columns[6].show();  
    }
    else {  
         App.grid1.columns[6].hide(); 
    }
    Last edited by Daniil; Sep 06, 2012 at 2:41 PM. Reason: Please use [CODE] tags
  4. #4
    Also you can use the setVisible function.
    http://docs.sencha.com/ext-js/4-1/#!...hod-setVisible

    Example
    var col = App.grid1.columns[6];
    
    col.setVisible(col.isHidden());
  5. #5
    Thank you Daniil.

    It is a good advice :)

Similar Threads

  1. hide columns Grid Ext 2.0
    By sysmo in forum 2.x Help
    Replies: 3
    Last Post: Jun 15, 2012, 8:07 PM
  2. Replies: 0
    Last Post: May 01, 2012, 10:43 AM
  3. [CLOSED] Disable/Hide row in PropertyGrid on client side
    By bakardi in forum 1.x Premium Help
    Replies: 9
    Last Post: Jun 09, 2011, 6:14 PM
  4. [CLOSED] How to get TableLayout columns property in client side
    By kenanhancer in forum 1.x Premium Help
    Replies: 23
    Last Post: Jan 14, 2011, 10:54 PM
  5. Replies: 0
    Last Post: Sep 17, 2009, 9:04 AM

Posting Permissions