jgg
jgg

Reputation: 1136

ExtJS, FormPanel show() function issue

I want to use FormPanel show() function to show it as pop up.

But below code does not show anything. but If I pass this formPanel to a ExtJS Window object and calling window show() function works fine.

I want to avoid creating a new Window object just to show a form panel. How do I do that?

    var formPanelItems = ...
    var formPanel = new Ext.form.FormPanel({
       width: 300px,
       height: 300px,
       items        : formPanelItems,
    });
    formPanel.show();

Upvotes: 1

Views: 6106

Answers (3)

Grant Zhu
Grant Zhu

Reputation: 3018

Per Ext's doc, you need to set config property floating:true and explicitly set the position of it after render because it is absolute positioned.

A sample:

var p = new Ext.form.FormPanel({
        title:'test', 
        width: 300, 
        height: 150, 
        html:'a floating panel', 
        floating: true, 
        renderTo: Ext.getBody()
}); 
p.setPosition(200,200);

Upvotes: 2

Damiano
Damiano

Reputation: 370

Try to look at this, might be useful: Dockable/floatable panels in ExtJS?

Upvotes: 0

Pavel Podlipensky
Pavel Podlipensky

Reputation: 8269

You need to set config property floatable: true. It will tell the control to render itself not to some parent element on the page, but directly to body

http://docs.sencha.com/ext-js/4-0/source/Panel3.html#Ext-panel-Panel-cfg-floatable

Upvotes: 0

Related Questions