javascript 如何仅使用 Formpanel 在 ExtJS 中打开弹出窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19826807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can i open popup window in ExtJS with formpanel only
提问by user191542
I have the Form panel which constains the form with fields.
我有包含带有字段的表单的表单面板。
Now on click of button , i am opening the window and then adding form as item in window like this
现在点击按钮,我打开窗口,然后像这样在窗口中添加表单作为项目
win = new Ext.Window({
title: 'Add',
layout: 'fit',
autoScroll: true,
y: 120,
width: 600,
height: 600,
modal: true,
closeAction: 'hide',
items: [formpanel]
});
win.show();
Now this shows two windows one shows the main window title Add
and border and then one more frame of formpanel with title and borders.
现在这显示了两个窗口,一个显示主窗口标题Add
和边框,然后再显示一个带有标题和边框的窗体面板框架。
Is there any way so that window only conatins form title and border but not windows title and border and background
有什么办法可以让窗口只包含标题和边框而不是窗口标题和边框和背景
Its like showuing only formPanle as popup , rather than formpanel inside window
它就像只显示 formPanle 作为弹出窗口,而不是在窗口内显示 formpanel
回答by Hariharan
Make it as floating
and closable
config to achieve your task.
使其成为floating
并closable
配置以完成您的任务。
closable:true
will help you to appear cross button at corner as you require.
closable:true
将帮助您根据需要在角落出现十字按钮。
var myForm = new Ext.form.Panel({
width: 500,
height: 400,
title: 'Foo',
floating: true,
closable : true
});
myForm.show();
I hope this will help.
我希望这将有所帮助。
回答by Sivakumar
floating: true
automatically fits the form in the center. If not you can use center() method of form.panel.
floating: true
自动使表格居中。如果没有,您可以使用 form.panel 的 center() 方法。
var myForm = new Ext.form.Panel({
width: 500,
height: 400,
title: 'Form Window',
floating: true,
closable : true
});
myForm.show();
Below call will make the form in center.
下面的调用将使表格居中。
myForm.center();