[CLOSED] GridPanel: How to remove header

  1. #1

    [CLOSED] GridPanel: How to remove header

    Hi,

    I want to clear the content of the GridPanel when a button is clicked.

    I tried gridpanel.ClearContent [server-side] but somehow this throws a javascript error.

    When I try to attach an empty DataTable to the Store, somehow the Header of the GridPanel remains.
    Server-Side:
    var stTabTrendingList = GridPanel_TabTrendingList.GetStore();
    stTabTrendingList.DataSource = new DataTable();
    stTabTrendingList.DataBind();
    I have checked that changing DataSource to empty DataTable makes the grid.ColumnModel.Columns.Count to zero (0) and the store.Reader.Count also to zero (0).

    Please advice.
    Last edited by Daniil; Oct 10, 2011 at 8:44 AM. Reason: [CLOSED]
  2. #2
    I'm not sure if I'm doing it wrong. So far, first load it is okay. When I clear, it clear the table. But when I reload the table, it remain empty.

    Loading/reloading the table (server-side):
    private void ShowTable(DataTable dt, int tWidth, int tHeight)
    {
        JsonReader reader = new JsonReader();
        GridPanel_TabTrendingList.Width = tWidth;
        GridPanel_TabTrendingList.Height = tHeight;
    
        var stTabTrendingList = GridPanel_TabTrendingList.GetStore();
        stTabTrendingList.Reader.Add(reader);
    
        GridPanel_TabTrendingList.ColumnModel.Columns.Clear();
        foreach (DataColumn column in dt.Columns)
        {
            reader.Fields.Add(column.ColumnName, MappingType(column.DataType));
            if (MappingType(column.DataType) == RecordFieldType.Float)
            {
                //This is column 4th onwards, and it is dynamic
                GridPanel_TabTrendingList.ColumnModel.Columns.Add(
                    new Column
                    {
                        Header = column.ColumnName,
                        DataIndex = column.ColumnName,
                        Width = 50,
                        Resizable = true,
                        Align = Alignment.Right,
                        Sortable = false,
                        Renderer = { Fn = "renderTable" }
                    }
                );
            }
            else
            {
                bool colSortable = false;
                int colWidth = 200;
                if (column.ColumnName == headerTest) colSortable = true;
                if (column.ColumnName == headerRange) colWidth = 100;
                if (column.ColumnName == headerUoM) colWidth = 60;
                GridPanel_TabTrendingList.ColumnModel.Columns.Add(
                    new Column
                    {
                        Header = column.ColumnName,
                        DataIndex = column.ColumnName,
                        Width = colWidth,
                        Resizable = true,
                        Sortable = colSortable
                    }
                );
            }
        }
        stTabTrendingList.DataSource = dt;
        stTabTrendingList.DataBind();
    }

    Clearing the Table (server-side)
    public void Clear()
    {
        var stTabTrendingList = GridPanel_TabTrendingList.GetStore();
        stTabTrendingList.DataSource = new DataTable();
        stTabTrendingList.DataBind();
        GridPanel_TabTrendingList.Reconfigure();
    }
    HTML
    <ext:GridPanel ID="GridPanel_TabTrendingList" runat="server" EnableHdMenu="false" Width="400" Height="400" StripeRows="true" TrackMouseOver="true">
        <Store>
            <ext:Store ID="Store_TabTrendingList" runat="server" WarningOnDirty="false" />
        </Store>
    </ext:GridPanel>
  3. #3
    Sorry for the inconvenience. I managed to fix this issue by inserting "GridPanel_TabTrendingList.Reconfigure();" between line # 48 and #49.

    Please close this ticket.

    Regards, J

Similar Threads

  1. Replies: 8
    Last Post: Sep 13, 2011, 8:47 PM
  2. [CLOSED] How to remove the TabPanel header bottom border?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 12, 2010, 3:09 PM
  3. [CLOSED] gridpanel header menu column checkbox remove
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 15, 2009, 11:28 AM
  4. [CLOSED] Remove sort Asc/Desc from grid header context menu
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 29, 2009, 2:59 PM
  5. Remove Sort Header
    By Kipetcoff in forum 1.x Help
    Replies: 2
    Last Post: Feb 15, 2009, 7:44 AM

Posting Permissions