extjs4.2_extjs4中操作选项卡用法

更新时间:2017-06-01    来源:extjs    手机版     字体:

【www.bbyears.com--extjs】

 代码如下

[html]
   

操作选项卡


   

[Js]
    var index = 0;

    //新增一个Tab
    Ext.createWidget("button", {
        text: "新增一个Tab",
        renderTo: "content2",
        handler: function () {
            tabs1.add({
                title: "新Tab " + (++index),
                id: "newTab" + index,
                html: "选项卡文本部分 " + (index) + "

",
                closable: true
            });
        }
    });

    //插入一个Tab
    Ext.createWidget("button", {
        text: "在2号位置插入新Tab",
        renderTo: "content2",
        handler: function () {
            tabs1.insert(2, {
                title: "新Tab " + (++index),
                id: "newTab" + index,
                html: "选项卡文本部分 " + (index) + "

",
                closable: true
            });
        }
    });

    //删除一个Tab
    Ext.createWidget("button", {
        text: "删除2号位置的Tab",
        renderTo: "content2",
        handler: function () {
            tabs1.remove(2);
        }
    });

    //删除id为“tab1”的Tab
    Ext.createWidget("button", {
        text: "删除id为“tab1”的Tab",
        renderTo: "content2",
        handler: function () {
            tabs1.remove("tab1");
        }
    });

    //删除id为“tab1”的Tab
    Ext.createWidget("button", {
        text: "设置第三个Tab为活动tab",
        renderTo: "content2",
        handler: function () {
            tabs1.setActiveTab(2);
        }
    });


效果:

本文来源:http://www.bbyears.com/wangyezhizuo/33063.html

猜你感兴趣