Tabpanel and Gridpanel problem

  1. #1

    Tabpanel and Gridpanel problem

    Hello Members.

    I am new to this site and i am starting to work with Ext.net witch i find very usefull for making richfull websites.

    My question is this..

    I have a methode that generates a Tabpanel and a Gridpanel.

    when i "add" the gridpanel to the tabpanel and renders it gridpanel adds a seperate tab with a title on it... does anybody know why its does that..

    if i make the same thing in javascript this does not accure at all.

    my code behinde looks like this..

    Methode witch generates it all:

    public static ext.DirectResponse CreateMe(string url, String container)
            {
                ext.Store store = BuildStore(url);
                ext.GridPanel g = BuildGrid();
                ext.TabPanel tab = BuildTab(container);
    
                g.Store.Add(store);
                store.DataBind();
                tab.Items.Add(g);
    
                ext.TabPanel mainTab = (ext.TabPanel)ext.X.GetCmp(container);
                mainTab.Items.Add(tab);
    
                tab.Render();
                tab.DoLayout();
                mainTab.SetActiveTab(tab);
                
               
                
                return new ext.DirectResponse();
            }
    BuildTab Methode:

    public static ext.TabPanel BuildTab(String container)
            {
                ext.TabPanel mainTab = (ext.TabPanel)ext.X.GetCmp(container);
                ext.TabPanel tab = new ext.TabPanel()
                {
                    ID = "tab"+(mainTab.Items.Count+1),
                    Title = "ServerTab" + (mainTab.Items.Count + 1),
                    Closable = true
                };
                return tab;
            }
    BuildGrid Methode:

    public static ext.GridPanel BuildGrid()
            {
                ext.GridPanel gp = new ext.GridPanel()
                {
                    ID = "gridTest",
                    Title = "Grid by Server",
                    Closable = false,
                    AutoWidth = true,
                    AutoHeight = false,
                    ColumnModel =
                    {
                        Columns =
                        {
                            new ext.Column()
                            {
                                ColumnID = "id",
                                Header = "ID",
                                DataIndex = "id",
                                Sortable = true
                            },
                            new ext.Column()
                            {
                                Header = "Name",
                                DataIndex = "name",
                                Sortable = true
                            },
                            new ext.Column()
                            {
                                Header = "Address",
                                DataIndex = "address",
                                Sortable = true
                            },
                            new ext.Column()
                            {
                                Header = "Zip",
                                DataIndex = "zip",
                                Sortable = true
                            },
                            new ext.Column()
                            {
                                Header = "Phone",
                                DataIndex = "phone",
                                Sortable = true
                            }
    
                        }
                    },
                    SelectionModel = 
                    {
                        new ext.RowSelectionModel()
                    },
                    View = 
                    {
                        new ext.GridView()
                        {
                            ForceFit = true,
                        }
                    },
                    Frame = true
                };
                return gp;
            }
    BuildStore Methode:

    private static ext.Store BuildStore(string url)
            {
               ext.Store store = new Ext.Net.Store()
                {
                    ID = "storeCus",
                    IDMode = Ext.Net.IDMode.Explicit,
                    Proxy =
                    {
                         new Ext.Net.HttpProxy()
                            {
                            Method = Ext.Net.HttpMethod.GET,
                            Json=true, 
                            Url= url
                            }
                    },
                    Reader = 
                    {
                        new Ext.Net.JsonReader()
                        {
                            IDProperty="id",
                            Root = "items",
                            TotalProperty="totalCount",
                            Fields =
                            {
                               new ext.RecordField()
                               {
                                   Name="id", Mapping="id"
                               },
                               new ext.RecordField()
                               {
                                   Name="name", Mapping="Name"
                               },
                               new ext.RecordField()
                               {
                                   Name="address", Mapping="Address"
                               },
                               new ext.RecordField()
                               {
                                   Name="zip", Mapping="Zipcode"
                               },
                               new ext.RecordField()
                               {
                                   Name="phone", Mapping="Phone"
                               }
    
                            }
                        }
                    }
                };
               return store;
            }
    Any good suggestions on what might cause this..

    First image is a tab made by the server side, second is made via javascript.
    Last edited by Akpenob; Jul 13, 2012 at 11:50 PM.
  2. #2
    Hi,

    Welcome to Ext.NET!

    Well, you add a TabPanel as a tab of another TabPanel. Then you place a GridPanel in that tab. Therefore I expect the same that the screenshot demonstrates.

    You don't need an additional tab, you can place the GridPanel directly to the main TabPanel.
  3. #3
    Hello Daniil

    Thank you for the reply.
    you can close this as i have found a solution at work, and yes you where correct i did not need to at add a sepperet panel.

    Again many thanks for your time and reply.

    Regards Akpenob

Similar Threads

  1. TabPanel layout problem
    By m_bo in forum 1.x Help
    Replies: 0
    Last Post: Mar 19, 2012, 9:10 AM
  2. TabPanel & 'Response.Redirect' problem
    By unaltro2 in forum 1.x Help
    Replies: 1
    Last Post: Oct 21, 2011, 8:19 AM
  3. Layout problem of a GridPanel inside TabPanel
    By omeriko9 in forum 1.x Help
    Replies: 1
    Last Post: Mar 15, 2011, 2:06 AM
  4. Problem TabPanel in code-behind
    By hilbert.blank in forum 1.x Help
    Replies: 2
    Last Post: Jul 09, 2009, 3:16 AM
  5. Tabpanel problem on postback
    By ianselmi in forum 1.x Help
    Replies: 2
    Last Post: Mar 10, 2009, 7:53 PM

Posting Permissions