学习EXTJS6(6)基本功能-工具栏和菜单

本文介绍了使用ExtJS创建垂直工具栏的方法,并展示了如何添加按钮及各种表单元素如单选框、复选框等。此外,还提供了工具栏启用与禁用的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

转载于:https://www.cnblogs.com/usegear/p/7765526.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值