[CLOSED] Issue with Gridpanel example and Tabpanel

  1. #1

    [CLOSED] Issue with Gridpanel example and Tabpanel

    Hi,

    I added a tabpanel to the gridpanel with roweditor example [https://examples2.ext.net/#/GridPane...ns/RowEditor/] and now the toolbar disappears as soon as a row is selected. If a gridpanel itself is a tab in tabpanel, the issue doesn't happen, but then I can't control the gridpanel width. Here's the modified code that reproduces the issue in IE8/9:

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.ObjectModel" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                var store = this.GridPanel1.GetStore();
    
                store.DataSource = new List<object>
                {
                    new { 
                        Name = "Bill Foot", 
                        Email = "bill.foot@object.net", 
                        Start = new DateTime(2007, 2, 5), 
                        Salary = 37000, 
                        Active = true
                    },
                    new { 
                        Name = "Bill Little", 
                        Email = "bill.little@object.net", 
                        Start = new DateTime(2009, 6, 13), 
                        Salary = 53000, 
                        Active = true
                    },
                    new { 
                        Name = "Bob Jones", 
                        Email = "bob.jones@object.net", 
                        Start = new DateTime(2008, 10, 6), 
                        Salary = 70000, 
                        Active = true
                    },
                    new { 
                        Name = "Bob Train", 
                        Email = "bob.train@object.net", 
                        Start = new DateTime(2009, 5, 5), 
                        Salary = 68000, 
                        Active = true
                    },
                    new { 
                        Name = "Chris Johnson", 
                        Email = "chris.johnson@object.net", 
                        Start = new DateTime(2009, 1, 25), 
                        Salary = 47000, 
                        Active = true
                    }
                };
    
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>GridPanel with RowEditor Plugin - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" type="text/css" />
    
        <ext:XScript ID="XScript1" runat="server">
            <script type="text/javascript">
                var addEmployee = function () {
                    var grid = #{GridPanel1};
                    grid.editingPlugin.cancelEdit();
    
                    // Create a record instance through the ModelManager
                    var r = Ext.ModelManager.create({
                        name: 'New Guy',
                        email: 'new@object.net',
                        start: new Date(),
                        salary: 50000,
                        active: true
                    }, 'Employee');
    
                    grid.store.insert(0, r);
                    grid.editingPlugin.startEdit(0, 0);
                }
                
                var removeEmployee = function () {
                    var grid = #{GridPanel1},
                        sm = grid.getSelectionModel();
    
                    grid.editingPlugin.cancelEdit();
                    grid.store.remove(sm.getSelection());
                    if (grid.store.getCount() > 0) {
                        sm.select(0);
                    }
                }
            </script>
        </ext:XScript>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
            <h1>GridPanel with RowEditor Plugin</h1>
            <ext:TabPanel ID="TabPanel1" runat="server" Height="300">
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Title="Tab 1">
                        <Items>
                            <ext:GridPanel
                                ID="GridPanel1"
                                runat="server"
                                Width="600"
                                Height="400"
                                Frame="true"
                                Title="Employees">
                                <Store>
                                    <ext:Store ID="Store1" runat="server">
                                        <Sorters>
                                            <ext:DataSorter Property="start" Direction="ASC" />
                                        </Sorters>
                                        <Model>
                                            <ext:Model ID="Model1" runat="server" Name="Employee">
                                                <Fields>
                                                    <ext:ModelField Name="name" Mapping="Name" Type="String" />
                                                    <ext:ModelField Name="email" Mapping="Email" Type="String" />
                                                    <ext:ModelField Name="start" Mapping="Start" Type="Date" />
                                                    <ext:ModelField Name="salary" Mapping="Salary" Type="Float" />
                                                    <ext:ModelField Name="active" Mapping="Active" Type="Boolean" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <Plugins>
                                    <ext:RowEditing ID="RowEditing1" runat="server" ClicksToMoveEditor="1" AutoCancel="false" />
                                </Plugins>
                                <TopBar>
                                    <ext:Toolbar ID="Toolbar1" runat="server">
                                        <Items>
                                            <ext:Button ID="Button1" runat="server" Text="Add Employee" Icon="UserAdd">
                                                <Listeners>
                                                    <Click Fn="addEmployee" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:Button ID="btnRemoveEmployee" runat="server" Text="Remove Employee" Icon="UserDelete" Disabled="true">
                                                <Listeners>
                                                    <Click Fn="removeEmployee" />
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:Toolbar>
                                </TopBar>
                                <ColumnModel>
                                    <Columns>
                                        <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="25" />
                                        <ext:Column ID="Column1" runat="server"
                                            Text="Name"
                                            DataIndex="name"
                                            Flex="1">
                                            <Editor>
                                                <ext:TextField ID="TextField1" runat="server" AllowBlank="false" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ID="Column2" runat="server" Text="Email" DataIndex="email" Width="160">
                                            <Editor>
                                                <ext:TextField ID="TextField2" runat="server" AllowBlank="false" Vtype="email" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:DateColumn ID="DateColumn1" runat="server"
                                            Text="Start Date"
                                            DataIndex="start"
                                            Format="MM/dd/yyyy"
                                            Width="100">
                                            <Editor>
                                                <ext:DateField ID="DateField1"
                                                    runat="server"
                                                    AllowBlank="false"
                                                    Format="MM/dd/yyyy"
                                                    MinDate="01.01.2006"
                                                    MinText="Can not have a start date before the Company existed."
                                                    MaxDate="<%# DateTime.Now %>"
                                                    AutoDataBind="true" />
                                            </Editor>
                                        </ext:DateColumn>
                                        <ext:NumberColumn ID="NumberColumn1"
                                            runat="server"
                                            Text="Salary"
                                            DataIndex="salary"
                                            Format="$0,0">
                                            <Editor>
                                                <ext:NumberField ID="NumberField1"
                                                    runat="server"
                                                    AllowBlank="false"
                                                    MinValue="1"
                                                    MaxValue="150000" />
                                            </Editor>
                                        </ext:NumberColumn>
                                        <ext:CheckColumn ID="CheckColumn1"
                                            runat="server"
                                            Text="Active?"
                                            DataIndex="active"
                                            Width="50">
                                            <Editor>
                                                <ext:Checkbox ID="Checkbox1" runat="server" Cls="x-grid-checkheader-editor" />
                                            </Editor>
                                        </ext:CheckColumn>
                                    </Columns>
                                </ColumnModel>
                                <Listeners>
                                    <SelectionChange Handler="#{btnRemoveEmployee}.setDisabled(!selected.length);" />
                                </Listeners>
                            </ext:GridPanel>
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel2" runat="server" Title="Tab 2">
                        <Items></Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel3" runat="server" Title="Tab 3">
                        <Items></Items>
                    </ext:Panel>
                </Items>
            </ext:TabPanel>
        </form>
    </body>
    </html>
    thanks in advance for your help.
    Last edited by Daniil; Oct 02, 2012 at 6:27 PM. Reason: [CLOSED]
  2. #2
    Your grid has Height (400px) greater than TabPanel height (300px)
    When you click on a row then browser switch the focus element and scrolling is performed
    I suggest to decrease grid height or
    1. Set Layout="AnchorLayout" for Panel1
    2. Remove Height for the grid
    3. Set Anchor="none 100%" for the grid
  3. #3
    should've checked simple things first. you're absolutely right, thank you!

Similar Threads

  1. [CLOSED] Tabpanel fit layout issue
    By edigital in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Aug 30, 2010, 3:35 PM
  2. [CLOSED] TabPanel issue?
    By drgw74 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 11, 2009, 10:08 AM
  3. [CLOSED] Tabpanel + Gridpanel: display issue
    By reinout.mechant@imprss.be in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 26, 2009, 9:58 AM
  4. [CLOSED] TabPanel loadContent Issue
    By Immobilmente in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 01, 2009, 1:03 PM
  5. TabPanel and ComboBox (Layout issue)
    By Timothy in forum Bugs
    Replies: 1
    Last Post: Sep 06, 2008, 3:04 PM

Posting Permissions