ExtJs Window doesn't render

血红的双手。 提交于 2019-12-24 16:34:21

问题


Please tell me why my window doesn't render. Below is the javascript that i am using

<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>

回答1:


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();

});



回答2:


I don't have enough reputation to comment above, but Lloyd is 100% correct. Windows float above the layout (position:absolute) whereas component items are rendered -into- the layout as nested parent/child node structures. 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). 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.



来源:https://stackoverflow.com/questions/1037503/extjs-window-doesnt-render

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!