[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);
}
});
|