zoukankan      html  css  js  c++  java
  • 学习EXTJS6(6)基本功能-工具栏和菜单

    <!DOCTYPE html>
    <html>
       <head>
        <meta http-equiv="Content-Type"  content="text/html;charset=utf-8">
        <link rel="stylesheet" type="text/css" href="../../study/EXTJS/ext-4.2.1.883/resources/css/ext-all.css" />
        <script type="text/javascript" src="../../study/EXTJS/ext-4.2.1.883/bootstrap.js"></script>
        <script type="text/javascript" src="../../study/EXTJS/ext-4.2.1.883/locale/ext-lang-zh_CN.js"></script>
     <script type="text/javascript">  
        Ext.onReady(function(){
    var toolbar = new Ext.toolbar.Toolbar({
        renderTo : 'toolbar',
        vertical :true,
        enableOverflow : true,
        width : 300});
    
        toolbar.add([
            {
                text : 'hello usegear',
                handler : onButtonClick,
                iconCls : 'newIcon'
            },
            {text:'open',handler:onButtonClick,iconCls:'openIcon'},
            {text:'save',handler:onButtonClick,iconCls:'saveIcon'}
            ]);
        function onButtonClick(btn){
            alert(btn.text);
            }
    
        });
    
    
    </script>
       </head>
       <body>
    <div id='toolbar'></div>
            </body>
    </html>
    包含按钮的简单工具栏

    效果:

    拓展思路:

    <!DOCTYPE html>
    <html>
       <head>
        <meta http-equiv="Content-Type"  content="text/html;charset=utf-8">
        <link rel="stylesheet" type="text/css" href="../../study/EXTJS/ext-4.2.1.883/resources/css/ext-all.css" />
        <script type="text/javascript" src="../../study/EXTJS/ext-4.2.1.883/bootstrap.js"></script>
        <script type="text/javascript" src="../../study/EXTJS/ext-4.2.1.883/locale/ext-lang-zh_CN.js"></script>
     <script type="text/javascript">  
        Ext.onReady(function(){
    var toolbar = new Ext.toolbar.Toolbar({
        renderTo : 'toolbar',
        vertical :true,
        enableOverflow : true,
        width : 300});
    
        toolbar.add([
            {text : 'hello usegear',handler : onButtonClick,iconCls : 'newIcon'},
            {text:'open',handler:onButtonClick,iconCls:'openIcon'},
            {text:'save',handler:onButtonClick,iconCls:'saveIcon'},
    {
        xtype:"radio",
        fieldLabel:"Label",
        boxLabel:"Box label",
        name:"radio",
        inputValue:"radiovalue"
      },{
        xtype:"checkbox",
        fieldLabel:"Label",
        boxLabel:"Box label",
        name:"checkbox",
        inputValue:"cbvalue"
      },{
        xtype:"datefield",
        fieldLabel:"Date",
        name:"datevalue"
      },{
        xtype:"timefield",
        fieldLabel:"Time",
        name:"timevalue"
      },{
        xtype:"numberfield",
        fieldLabel:"Number",
        name:"numbervalue"
      },{
        xtype:"textfield",
        fieldLabel:"Text",
        name:"textvalue"
      },{
        xtype:"combo",
        fieldLabel:"Text",
        name:"combovalue",
        hiddenName:"combovalue"
      },{
        xtype:"fieldset",
        title:"Legend",
        autoHeight:true
      },
            
            {xtype:"panel",
    text:"Panel",
    items:[{
        xtype:"checkbox",
        boxLabel:"Box label",
        name:"checkbox",
        inputValue:"cbvalue"
      },{
        xtype:"radio",
        boxLabel:"Box label",
        name:"radio",
        inputValue:"radiovalue"
      },{
        xtype:"checkbox",
        boxLabel:"Box label",
        name:"checkbox",
        inputValue:"cbvalue"
      }]
      }
      ]
            
            
            
            );
        function onButtonClick(btn){
            alert(btn.text);
            }
    
        });
    
    
    </script>
       </head>
       <body>
    <div id='toolbar'></div>
            </body>
    </html>
    工具栏

    效果:

    http://www.tof2k.com/ext/formbuilder/,导出json参数,然后。。。相当方便。否则手工码砖,效率可知了。

     工具栏的启用和禁用,有二个方法:enable()和disable()

  • 相关阅读:
    性能分析
    单例模式
    装饰者模式
    开发Chrome Extension截取你微博的帐号密码
    201703-3 markdown
    201612-3 权限查询
    201609-3 炉石传说
    201604-2 俄罗斯方块
    201604-3 路径解析
    201512-1 数位之和
  • 原文地址:https://www.cnblogs.com/usegear/p/7765526.html
Copyright © 2011-2022 走看看