Results 1 to 4 of 4

Thread: Dynamically add FormPanel

  1. #1

    Default Dynamically add FormPanel

    Hello,

    I'm extending the Panel, and would like to add a FormPanel to every new instance automatically.

    Code:
    Ext.myPanel = Ext.extend(Ext.Panel, {
    	
    	...
    	
    	initComponent: function() {
    		Ext.myPanel.superclass.initComponent.apply(this, arguments);
    		this.add(new Ext.form.FormPanel({
    			
    			...
    			
    		}));
    	}
    
    
    });
    The problem is, it only works in Safari, i.e. not in Firefox or Chrome. If I change 'Ext.form.FormPanel' to 'Ext.Panel', then it works.

    In Chrome, it says: 'Uncaught TypeError: Cannot call method 'addClass' of null'.
    In Firefox: 'this.body is null'

    I tried to move the '.add' to 'onRender', to use ComponentMgr.create, to use 'this.items = ...', none of which works.

    Please, does anyone know how to add a FormPanel to every new 'myPanel'?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    Please don't double post. I replied to your bug report that isn't an ExtJS bug.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default Maybe nested forms?

    If your myPanel is a descendant component of another FormPanel, then you won't be able to add a FormPanel to it, because that would mean you would have nested FormPanels, which will cause an error since it is not allowed in HTML to have form element as a child of another form element.

    Is your myPanel Panel somewhere a child of another FormPanel?

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    16

    Default

    good stuff for the last tip,... that was exactly my problem

Similar Threads

  1. Can't dynamically change FormPanel contents
    By JoeB in forum Sencha GXT Q&A
    Replies: 0
    Last Post: 3 Sep 2009, 8:47 AM
  2. Why can't I dynamically add a FormPanel to an Ext.Window?
    By wgpubs in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 11 Aug 2009, 3:01 AM
  3. HOW TO: Dynamically add new fieldset to FormPanel?
    By wgpubs in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 14 Jul 2009, 2:03 AM
  4. How to load FormPanel Dynamically?
    By carbotex in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 20 Nov 2008, 3:29 PM
  5. How to dynamically create columns in FormPanel
    By ntulip in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 19 Oct 2007, 12:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •