Threaded View

  1. #1
    Ext GWT Premium Member
    Join Date
    Apr 2009
    Location
    NYC
    Posts
    111
    Answers
    2
    Vote Rating
    1
    stan229 is on a distinguished road

      0  

    Default Answered: Nesting FormPanel in Modal Window

    Answered: Nesting FormPanel in Modal Window


    What is the best way about going about nesting a Ext.form.Panel in a modal popup
    Code:
    var popup = Ext.create('Ext.Panel', {
                floating : true,
                modal : true,
                centered : true,
                width : 300,
                height : 400,
                items : [{
                    docked : 'top',
                    xtype : 'toolbar',
                    title : 'Add Borrower'
                }, {
                    xtype : 'formpanel',
                    items : [{
                        xtype : 'textfield',
                        name : 'hello',
                        label : 'hello'
                    }]
                }],
                scrollable : true
            });
    
            popup.show()
    Doesn't show the fields, renders the window with toolbar. If I make the xtype to be fieldset it draws the textfield. If I nest a fieldset xtype with the textfield in it, also doesn't work.

  2. Hi Stan.
    You just need to set your panel layout as 'fit'.
    Please even notice that the "floating" config has been deprecated, so you only need to set the "centered" config as true.

    Code:
    var popup = Ext.create('Ext.Panel', {
                modal : true,
                centered : true,
                width : 300,
                height : 400,
    	    layout: 'fit',
                items : [{
                    docked : 'top',
                    xtype : 'toolbar',
                    title : 'Add Borrower'
                }, {
                    xtype : 'formpanel',
                    items : [{
                        xtype : 'textfield',
                        name : 'hello',
                        label : 'hello'
                    }]
                }],
                scrollable : true
            });
    
    
            popup.show()
    Hope this helps.

Thread Participants: 1