[CLOSED] GridPanel with many columns

  1. #1

    [CLOSED] GridPanel with many columns

    I have a grid that has a large amount of columns (some visible, some not). When I go to add more columns to the grid via the column header menu, the list of available columns extends past the bottom of the screen. Is it possible to organize that menu differently? Perhaps being able to scroll it or have multiple menu columns?
    Last edited by Daniil; Aug 15, 2011 at 3:47 PM. Reason: [CLOSED]
  2. #2
    Hi,

    A vertical scrollbar appears for me in the example below.

    As well there is a way to change the columns menu in the example.

    Example

    <%@ Page Language="C#" %> 
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 50; i++)
            {
                Column c = new Column()
                {
                    Header = "Test" + i,
                    DataIndex = "test"
                };
     
                this.GridPanel1.ColumnModel.Columns.Add(c);
            }
             
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                
                store.DataSource = new object[] 
                { 
                    new object[] { "test" },
                };
                
                store.DataBind();
            }
        }
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
     
        <script type="text/javascript">
            var onRender = function (grid) {
                var view = grid.getView();
                view.colMenu.un("beforeshow", view.beforeColMenuShow, view);
                view.colMenu.on("beforeshow", customBeforeColMenuShow, view);
            };
     
            var customBeforeColMenuShow = function () {
                //Here is the original code of .beforeColMenuShow()
                var colModel = this.cm,
                    colCount = colModel.getColumnCount(),
                    colMenu  = this.colMenu,
                    i;
     
                colMenu.removeAll();
     
                for (i = 0; i < colCount; i++) {
                    if (colModel.config[i].hideable !== false) {
                        colMenu.add(new Ext.menu.CheckItem({
                            text        : colModel.getColumnHeader(i),
                            itemId      : 'col-' + colModel.getColumnId(i),
                            checked     : !colModel.isHidden(i),
                            disabled    : colModel.config[i].hideable === false,
                            hideOnClick : false
                        }));
                    }
                }
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
    
            <ext:Window runat="server" Title="Example" Height="350" Width="500" Layout="FitLayout">
                <Items>
                    <ext:GridPanel ID="GridPanel1" runat="server">
                        <Store>
                            <ext:Store runat="server">
                                <Reader>
                                    <ext:ArrayReader>
                                        <Fields>
                                            <ext:RecordField Name="test" />
                                        </Fields>
                                    </ext:ArrayReader>
                                </Reader>
                            </ext:Store>
                        </Store>                                                                        
                        <Listeners>
                            <Render Handler="onRender(this);" />
                        </Listeners>
                    </ext:GridPanel>
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Last edited by geoffrey.mcgill; Nov 08, 2011 at 6:40 PM.

Similar Threads

  1. [CLOSED] GridPanel - state for columns
    By PatrikG in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 13, 2012, 1:48 PM
  2. [CLOSED] generating columns in a GridPanel
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 11, 2011, 2:27 PM
  3. How to add a tip for Gridpanel's Columns ?
    By Yanfang Wang in forum 1.x Help
    Replies: 8
    Last Post: Jun 07, 2010, 11:14 AM
  4. [CLOSED] Hidden Columns in GridPanel?
    By state in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 02, 2009, 2:52 PM
  5. [CLOSED] GridPanel columns width
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 03, 2009, 10:04 AM

Tags for this Thread

Posting Permissions