简体   繁体   English

ExtJs窗口不呈现

[英]ExtJs Window doesn't render

Please tell me why my window doesn't render. 请告诉我为什么我的窗户不呈现。 Below is the javascript that i am using 以下是我正在使用的javascript

<link href="/Scripts/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css"/>

    <script src="/Scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="/Scripts/ext/adapter/jquery/ext-jquery-adapter.js" type="text/javascript"></script>
    <script src="/Scripts/ext/ext-all.js" type="text/javascript"></script>




    <script type="text/javascript">
        $(function() {
            var viewport = new Ext.Viewport({
                items:[[
  {
    "minimizable": true,
    "maximizable": true,
    "title": "Hello World",
    "height": 300,
    "width": 400,
    "xtype": "window"
  }
]]
            });
        });
    </script>

Why would you create a window as an item of a viewport like that? 为什么要创建一个窗口作为这样的视口项? You don't do that. 你不这样做。

Do: 做:

Ext.onReady(function() {

var win = new Ext.Window({
  minimizable: true,
  maximizable: true,
  title: "Hello World",
  height: 300,
  width: 400
});

win.show();

});

I don't have enough reputation to comment above, but Lloyd is 100% correct. 我没有足够的声誉在上面评论,但劳埃德100%正确。 Windows float above the layout (position:absolute) whereas component items are rendered -into- the layout as nested parent/child node structures. Windows浮动在布局上方(位置:绝对),而组件项在布局中呈现为嵌套的父/子节点结构。 If you look at the markup for a rendered Window, it is created at the document body level -- there is no relationship between it and any layout panels. 如果查看渲染窗口的标记,则会在文档正文级别创建它 - 它与任何布局面板之间没有关系。

It may be a confusion over naming -- as Lloyd said, a Panel is what you actually want (and is what gets created by default when you add an item to a viewport). 这可能是对命名的困惑 - 正如Lloyd所说,Panel是你真正想要的(并且是在向视口添加项目时默认创建的)。 Panels function much like windows, but they are built into the layout structure instead of floating above it. 面板的功能与窗口非常相似,但它们内置于布局结构中,而不是浮动在其上方。 If you really want a window, then use Lloyd's code. 如果你真的想要一个窗口,那就用Lloyd的代码吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM