zoukankan      html  css  js  c++  java
  • ExtJs学习笔记(9)_Window的基本用法

    以下就是ExtJs的官方示例,只不过加了几行注释,呵

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        
    <title>Hello World Window Example</title>
        
    <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />   
         
    <script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
        
    <script type="text/javascript" src="../ext-all-debug.js"></script>
        
    <style type="text/css">
        .x-panel-body p 
    {
            margin
    :10px;
            font-size
    :12px;
        
    }
        
    </style>
    </head>
    <body>
    <script type="text/javascript">
        Ext.onReady(
    function() {
            
    var win;
            
    var button = Ext.get('show-btn');

            button.on(
    'click'function() {            
                
    if (!win) {
                    win 
    = new Ext.Window({
                        applyTo: 
    'Container',
                        layout: 
    'fit'//fit布局会使容器内的组件自动充满容器(Resize容器时,自动重绘)
                        //title:"new Title",//不加这一句时,会自动寻找Container中样式为x-window-header的div,将其内容做为window的title
                         500,
                        height: 
    300,
                        closeAction: 
    'hide',//关闭后,仅隐藏,方便下次再显示
                        plain: true,
                        items: 
    new Ext.TabPanel({
                            applyTo: 
    'hello-tabs',
                            autoTabs: 
    true//加上这个后,会在hello-tabs里自动寻找样式为x-tab的div,根据title标识创建tab,根据div内容创建tab内容
                            activeTab: 0,
                            deferredRender: 
    false,
                            border: 
    false
                        }),

                        buttons: [{
                            text: 
    'Submit',
                            disabled: 
    true
                        }, {
                            text: 
    'Close',
                            handler: 
    function() {
                                win.hide();
                            }
    }]
                        });
                    }
                    win.show(button);
    //注意win.show()与win.show(button)的区别,show(button)会使弹出窗口看起来象从button上弹出来的,具有动画效果,而win.show()则没有这一动画效果
                });
            });
    </script>

    <input type="button" id="show-btn" value="Hello World" /><br /><br />

    <div id="Container" class="x-hidden">
        
    <div class="x-window-header">Hello Dialog</div>
        
    <div id="hello-tabs">
            
            
    <div class="x-tab" title="Hello World 1">
                
    <p>Hello</p>
            
    </div>
            
            
    <div class="x-tab" title="Hello World 2">
                
    <p> World!</p>
            
    </div>
        
    </div>
    </div>

    </body>
    </html>

    作者:菩提树下的杨过
    出处:http://yjmyzz.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    Python虚拟开发环境pipenv
    挖矿木马的应急响应
    熟悉使用ConfigParser库读写配置文件
    Django的RestfulAPI框架RestFramework
    使用DnsCat反弹shell
    使用mimikatz获取和创建Windows凭据的工具和方法
    拿下主机后内网的信息收集
    iOS 新浪微博-5.0 首页微博列表
    xcode 各版本下载地址及其它工具下载地址
    iOS 新浪微博-4.0 OAuth授权
  • 原文地址:https://www.cnblogs.com/yjmyzz/p/1281096.html
Copyright © 2011-2022 走看看