[CLOSED] Dynamic Store/GridPanel with AutoHeight on Grid doesn't show headers.

  1. #1

    [CLOSED] Dynamic Store/GridPanel with AutoHeight on Grid doesn't show headers.

    If you dynamically create a store from a datatable, and dynamically create a gridpanel from the same datatable, and bind,
    the Column Headers don't show if you have AutoHeight="true" in the GridPanel.
    Set the Height="200" and the column headers DO show!!!

    Please let me know how to fix...

    STORE:
     <ext:Store id="storeMgmt" runat="server" autoload="false" AutoDataBind="true">
            <AjaxEventConfig isupload="true" />
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="FundId" Type="Int" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
    GRID:
          <ext:GridPanel id="gridMgmt" striperows="true"   Title="Management Company" header="true" trackmouseover="true" runat="server" storeid="storeMgmt"   height="200">
      
            <ColumnModel id="ColumnModel2" runat="server">
                <Columns>
           
                </Columns>
            </ColumnModel> 
        </ext:GridPanel>
    CODE BEHIND:
       private void FillGrid(Store s, GridPanel g, DataTable dt)
            {
                s.RemoveFields();
                foreach (DataColumn c in dt.Columns)
                    if (!c.ColumnName.Contains("Id"))
                        s.AddField(new RecordField(c.ColumnName, RecordFieldType.Auto ));
             
    
                GridFilters f = new GridFilters();
                f.Local = true;
                g.Plugins.Add(f);
                foreach (DataColumn c in dt.Columns)
                {
                    if (!c.ColumnName.Contains("Id"))
                    {
                        StringFilter sFilter = new StringFilter();
                        sFilter.AutoDataBind = true;
                        sFilter.DataIndex = c.ColumnName;
                        f.Filters.Add(sFilter);
                    }
          
    
                }
    
    
    
                Column col = null;
               // g.ColumnModel.Columns.Clear();
                foreach (DataColumn c in dt.Columns)
                {
                    if (!c.ColumnName.Contains("Id"))
                    {
                        col = new Column();
                        col.DataIndex = c.ColumnName;
                        col.ColumnID = c.ColumnName;
                        col.Header = c.ColumnName;
                        col.Sortable = true;
                        col.Width = Unit.Pixel(100);
                        col.Groupable = false;
                        col.MenuDisabled = false;
                        col.Align = Alignment.Center;
                        g.ColumnModel.Columns.Add(col);
                    }
                }
                g.Reconfigure();
        
                s.DataSource = dt;
                s.DataBind(); 
                g.DataBind();
            }
     public void GetRequired(object sender, AjaxEventArgs e)
            {
                try
                {
    
                    DataSet ds = SPs.GetRequiredDocuments(Convert.ToInt32(this.hidSelectedEntityTypeId.Text), Convert.ToInt32(this.hidSelectedEntityId.Text)).GetDataSet();
    
                    FillGrid(this.storeMgmt, this.gridMgmt, ds.Tables[0]);
                   
                    ds = null;
                }
    
                catch (Exception er)
                {
                   
                }
    
            }
  2. #2

    RE: [CLOSED] Dynamic Store/GridPanel with AutoHeight on Grid doesn't show headers.

    Hi Raphael,

    The GridPanel must either have a fixed .Height set, or the height must be managed by a Layout. You can configure the GridPanel to be managed by a Layout by adding the GridPanel inside a Layout control, or in v1.0 setting the .Layout property of the parent Container.


    It would be best to remove the .AutoHeight=true value from your GridPanel configuration.


    Quote from GridPanel docs, http://www.extjs.com/deploy/dev/docs...grid.GridPanel


    A grid requires a width in which to scroll its columns, and a height in which to scroll its rows. These dimensions can either be set explicitly through the height and width configuration options or implicitly set by using the grid as a child item of a Container which will have a layout manager provide the sizing of its child items (for example the Container of the Grid may specify layout:'fit').

    Hope this helps.


    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 0
    Last Post: Mar 15, 2012, 9:29 AM
  2. Replies: 12
    Last Post: Sep 20, 2011, 2:33 PM
  3. Tree Grid - Doesn't show child nodes be default.
    By Sagar2529 in forum 1.x Help
    Replies: 3
    Last Post: Feb 25, 2011, 9:13 AM
  4. [CLOSED] RowExpander: GridPanel button doesn't show
    By capecod in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 03, 2010, 3:36 PM
  5. Replies: 1
    Last Post: Oct 27, 2009, 10:39 AM

Posting Permissions