Panel isn't collapsing after dynamically add a fieldset

  1. #1

    Panel isn't collapsing after dynamically add a fieldset

    Hi all,

    I'm trying to dynamically add a FieldSet with a TextField inside a Panel. After the insertion the panel can collapse, but after that it can't expand!

    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
    
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <title>Index</title>
        <script type="text/javascript">
            var LoadFieldSet = function () {
                App.Panel1.add(Ext.create('Ext.form.FieldSet'), {
                    id: 'fsPrincipal'
                });
    
                Ext.Array.include(App.fsPrincipal.items.items, Ext.create('Ext.form.field.Text', "['xtype': 'textfield', id: 'tf1', name: 'tf1' ]"));
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Panel ID="Panel1" Margin="10" runat="server" Collapsible="True" CollapseMode="Default"
            TitleCollapse="True" Collapsed="False">
            <HeaderConfig Enabled="True" HideMode="Offsets" Title="teste header">
            </HeaderConfig>
            <Items>
                <ext:Button ID="btnExec" runat="server" Text="Button1">
                    <Listeners>
                        <Click Fn="LoadFieldSet">
                        </Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Panel>
    </body>
    </html>
    What is wrong with this code?
  2. #2
    Hello!

    Try the following:

    <script type="text/javascript">
    	var LoadFieldSet = function () {
    		App.Panel1.add(Ext.create('Ext.form.FieldSet'), {
    			id: 'fsPrincipal',
    			items: [{
    				xtype: 'textfield',
    				id: 'tf1',
    				name: 'tf1'
    			}]
    		});
    	}
    </script>
  3. #3
    I can't do that!

    I need to insert the items in a different moment, not when the Panel is being created.
  4. #4
    Therefore you need to use 'add' method instead items collection directly
  5. #5
    Thanks Vladimir, it worked!

Similar Threads

  1. [CLOSED] [1.0] Problem collapsing North Panel
    By bbo1971 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 17, 2010, 6:39 PM
  2. [CLOSED] Ext.EventManager is undefined when collapsing panel
    By UGRev in forum 1.x Legacy Premium Help
    Replies: 22
    Last Post: Apr 16, 2010, 2:59 PM
  3. Replies: 11
    Last Post: Apr 08, 2010, 1:36 PM
  4. FieldSet title shifting when expanding/collapsing
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: May 28, 2009, 7:57 PM
  5. FieldSet title shifting when expanding/collapsing
    By dbassett74 in forum 1.x Help
    Replies: 4
    Last Post: May 06, 2009, 1:15 PM

Tags for this Thread

Posting Permissions