Toolbar组件

创建工具栏

Toolbar类是一种子组件,它不能独立存在,需要依附在其它组件上面。很多容器组件都具备tbar(顶部工具栏)、bbar(底部工具栏)的配置,所以可以像下面那样使用它。

tbar: {
    id: "tool",
    width: ,
    height: ,            
    items: [
        { text: "新  增", itemId: "btn1", style: "background:none;border:none;",iconCls: "btnIco", handler: function () { alert() } }, //默认是按钮
        { xtype: 'tbseparator' }, //分隔符
        { xtype: 'tbspacer', width:  }, //指示物件的间距
        { xtype: "text", text: "纯文本" },
        { xtype: 'tbfill' }, //指示出现在tbfill之后的物件右对齐
        { xtype: "textfield",fieldLabel:"查询",labelWidth: }, //可配置为表单组件
    ]
}

设置按钮内的文字和按钮内的图标

/*按钮文字*/
.x-btn-inner {
    font-family: Arial !important;
    color: white !important;
} /*按钮a标签*/
.x-btn {
    text-decoration: none !important;
}  /*按钮内图标*/
.btnIco {
    background: url(../../Img/Ico/login.png);
    margin-left:78px;

创建菜单

菜单组件可浮动在鼠标的轨迹上,也可以附加在工具栏上。

//右键点击grid时创建右键菜单
Ext.create("Ext.grid.Panel", {
    //……
    listeners: {
        itemcontextmenu: function (view, record, item, index, e) {
            e.preventDefault();
            Ext.create("Ext.menu.Menu", {
                id: "contextmenu",
                items: [
                    {
                        text: "全选",
                        handler: function () {
                        }
                    },
                    {
                        text: "反选",
                        hanlder: function () {
                        }
                    }
                ],
                listeners: {
                    deactivate: function (menuSelf) {
                        menuSelf.destroy(); //消失后销毁自身
                    }
                }
            });
            Ext.getCmp("contextmenu").showAt(e.getXY()); //显示在鼠标右键点击处
        }
    }
});

浮动

tbar: {
    id: "tool",
    width: ,
    height: ,            
    items: [
        {
            type: "button",
            text: "文  件",
            itemId: "btn1",
            style: "background:none;border:none;text-decoration:none;",
            menu: {
                items: [
                    { text: '复制', hanler: function () {/*点击菜单时触发*/ },deactivate:function()(menuSelf){/*菜单消失后触发*/} },
                    { text: '剪切' },
                    { text: '撤销' }
                ]
            }
        }      
    ]
}

固定

创建按钮

Ext.create('Ext.Button', {
    text: 'OK',
    style: "background:red;border:none;margin:10px 0;", icon: "../img/ico/expand-down.png",
    renderTo: "bbtn",
    handler: function () { }
});

{
    xtype: "button",
    text: "选择全部",
    style: "margin-right:10px;",
    handler: function () {
        //获得按钮的文字
        if (this.getText() == "选择全部") {
            //设置按钮的文字
            this.setText("全部取消");
        }
        else {
            this.setText("选择全部");
        }
    }
}

Javascript - 学习总目录

Javascript - ExtJs - Toolbar - 工具栏的更多相关文章

  1. Javascript - ExtJs - GridPanel组件

    GridPanel组件(Ext.grid.GridPanel)logogram:Ext.grid.Panel | xtype:gridpanel 此类派生自Ext.Panel,创建表格需要两个必须的对 ...

  2. [转载]ExtJs4 笔记(12) Ext.toolbar.Toolbar 工具栏、Ext.toolbar.Paging 分页栏、Ext.ux.statusbar.StatusBar 状态栏

    作者:李盼(Lipan)出处:[Lipan] (http://www.cnblogs.com/lipan/)版权声明:本文的版权归作者与博客园共有.转载时须注明本文的详细链接,否则作者将保留追究其法律 ...

  3. Javascript - ExtJs - Ext.form.Panel组件

    FormPanel组件(Ext.form.FormPanel) logogram:Ext.form.Panel | xtype:form Ext.form.Panel.配置 frame }//旗下所有 ...

  4. ExtJs4 笔记(12) Ext.toolbar.Toolbar 工具栏、Ext.toolbar.Paging 分页栏、Ext.ux.statusbar.StatusBar 状态栏

    本篇讲解三个工具栏控件.其中Ext.toolbar.Toolbar可以用来放置一些工具类操控按钮和菜单,Ext.toolbar.Paging专门用来控制数据集的分页展示,Ext.ux.statusba ...

  5. 第15.15节 PyQt(Python+Qt)入门学习:Designer的menu菜单、toolBar工具栏和Action动作详解

    老猿Python博文目录 老猿Python博客地址 一.引言 Qt Designer中的部件栏并没有菜单.toolBar以及Action相关的部件,仅在MainWindow类型窗口提供了menu.to ...

  6. ExtJs之工具栏及菜单栏

    先培养一下大概的感觉吧. 基本按书上都弄出来了. <!DOCTYPE html> <html> <head> <title>ExtJs</titl ...

  7. Javascript - ExtJs - 整合百度文章编辑器

    ExtJs - 整合百度文章编辑器(ExtJs UEditor) 第一步:去官网下载最新版本的UEditor,UEditor下载. 第二步:在编辑器根目录创建一个Extjs-Editor.js,录入以 ...

  8. Javascript - ExtJs - 组件 - 分页

    服务端只需要返回如下格式的字符串,ExtJs就可以解析并自动生成分页数据.  , name: "sam" }     ] } 准备: CREATE PROCEDURE [dbo]. ...

  9. Javascript - ExtJs - Itemselector

    引入扩展文件 Extjs4.2根目录下: examples \ ux \ css \ images (这是选择按钮的图片资源) examples \ ux \ css \ ItemSelector.c ...

随机推荐

  1. java练习:质数,匿名内部类创建接口,抽象类派生子类,画圆,字节截取字符串,数字变钱币,五子棋,梭哈

    java学习-质数的孤独 正在看质数的孤独,,,于是写了一个练习代码,输出1-100之间的质数 代码比较烂.待完善吧. 这里用到了continue和break,continue指结束当前轮次循环,跳入 ...

  2. POJ 3463 Sightseeing (次短路经数)

    Sightseeing Time Limit: 2000MS   Memory Limit: 65536K Total Submissions:10005   Accepted: 3523 Descr ...

  3. mysql 删除用户

    select * FROM sys_user_role where user_id in( SELECT id FROM sys_user where login_name='17600311226' ...

  4. mysql 变量定义 sql查询

    SET @idnoStr:='"idNo":"'; SELECT LOCATE(@idnoStr, param_array), LOCATE('",', par ...

  5. (叉乘求面积) nyoj1011-So Easy[II]

    1011-So Easy[II] 内存限制:64MB 时间限制:1000ms 特判: No通过数:2 提交数:4 难度:2 题目描述: 这是一道基础的计算几何问题(其实这不提示大家也都看的出).问题描 ...

  6. (线段判交的一些注意。。。)nyoj 1016-德莱联盟

    1016-德莱联盟 内存限制:64MB 时间限制:1000ms 特判: No通过数:9 提交数:9 难度:1 题目描述: 欢迎来到德莱联盟.... 德莱文... 德莱文在逃跑,卡兹克在追.... 我们 ...

  7. (map,c_str())水果 hdu1263

    水果 http://acm.hdu.edu.cn/showproblem.php?pid=1263 Time Limit: 2000/1000 MS (Java/Others)    Memory L ...

  8. C#梳理【集合Collection】

    C# 集合(Collection) 集合(Collection)类是专门用于数据存储和检索的类.这些类提供了对栈(stack).队列(queue).列表(list)和哈希表(hash table)的支 ...

  9. 91 Testing MySQL学习总结

    91 Testing MySQL学习总结 --------- 在WEB应用方面MySQL是最好的RDBMS(Relational Database Management System什么是数据库?数据 ...

  10. social-auth-app-django集成第三方登录

    GitHub:https://github.com/python-social-auth/social-app-django 官网文档:http://python-social-auth.readth ...