Ext.Toolbar
当在工具条中同时出现Menu和Element时,会导致Menu失灵。
1、Ext.Toolbar的常用方法:
addButton()
addElement()
addField()
addFill()
addSeparator()
addText()
add()
2、普通工具条
- Ext.onReady(function(){
- Ext.BLANK_IMAGE_URL = "../widgets/ext-3.0/resources/images/default/s.gif";
- Ext.QuickTips.init();
- var currnetItem = null;
- //菜单工具条
- var fileMenu = new Ext.menu.Menu({
- shadow: "sides",
- items: [
- {text:"新建", menu:[
- {text:"Word文档", handler:onMenuItem},
- {text:"Excel文档"},
- {text:"文本文件"}
- ]},
- {text:"打开", handler:onMenuItem},
- "-",
- {text:"关闭", handler:onMenuItem}
- ]
- });
- var editMenu = new Ext.menu.Menu({
- items: [
- {text:"剪切", handler:onMenuItem},
- {text:"复制", handler:onMenuItem},
- {text:"粘贴", handler:onMenuItem}
- ]
- });
- var themeMenu = new Ext.menu.Menu({
- items: [
- {id:"default", text:"默认", checked:true, group:"theme", checkHandler:onItemCheck},
- {id:"red", text:"红色", checked:false, group:"theme", checkHandler:onItemCheck},
- {id:"green", text:"绿色", checked:false, group:"theme", checkHandler:onItemCheck},
- {id:"gray", text:"灰色", checked:false, group:"theme", checkHandler:onItemCheck},
- "-",
- {text:"禁用", checked:false, checkHandler:onCheckboxItem}
- ]
- });
- var scrollMenu = new Ext.menu.Menu({
- maxHeight: 200,
- showSeparator: false
- });
- for (var i = 0; i < 50; ++i){
- scrollMenu.add({
- text: 'Item ' + (i + 1)
- });
- }
- var t3 = new Ext.Toolbar({
- items:[
- {text:"文件", menu:fileMenu},
- {text:"编辑", menu:editMenu},
- {text:"主题", menu:themeMenu},
- "-",
- {id:"add", text:"新建", iconCls:"add", enableToggle:true, toggleHandler:onToggleHandler},
- {id:"save", text:"保存", iconCls:"save", handler:onToolbarButton},
- {id:"delete", text:"删除", iconCls:"delete", handler:onToolbarButton},
- {icon:"../images/toolbar/help.gif", tooltip:"帮助文档"},
- {xtype:"splitbutton", text:"滚动菜单", menu:scrollMenu},
- "-",
- {xtype:"textfield", width:100},
- "->",
- {
- text:"enabled",
- handler: function(){
- if(currnetItem!=null && currnetItem.enable){
- currnetItem.setDisabled(false);
- currnetItem = null;
- alert(currnetItem);
- }
- }
- },
- "-",
- "工具条"
- ]
- });
- new Ext.Panel({
- title: "普通工具条",
- renderTo: "div1",
- frame: true,
- width: 700,
- tbar: t3,
- bodyStyle: "background-color:#FFFFFF; height:50; padding:3px;",
- html: "当在工具条中同时出现Menu和Element时,会导致Menu失灵。"
- });
- //单击工具条上的按钮时触发该函数
- function onToolbarButton(btn){
- alert(btn.id);
- }
- //单击菜单项时触发该函数
- function onMenuItem(item){
- alert(item.text);
- //item.setDisabled(true);
- //currnetItem = item;
- }
- //checked的值变化时触发该函数
- function onItemCheck(item, checked){
- if(checked) alert(item.text);
- }
- function onCheckboxItem(item){
- themeMenu.get("default").setDisabled(item.checked);
- themeMenu.get("red").setDisabled(item.checked);
- themeMenu.get("green").setDisabled(item.checked);
- themeMenu.get("gray").setDisabled(item.checked);
- }
- function onToggleHandler(item, pressed){
- alert(pressed);
- }
- });
Ext.onReady(function(){ Ext.BLANK_IMAGE_URL = "../widgets/ext-3.0/resources/images/default/s.gif"; Ext.QuickTips.init(); var currnetItem = null; //菜单工具条 var fileMenu = new Ext.menu.Menu({ shadow: "sides", items: [ {text:"新建", menu:[ {text:"Word文档", handler:onMenuItem}, {text:"Excel文档"}, {text:"文本文件"} ]}, {text:"打开", handler:onMenuItem}, "-", {text:"关闭", handler:onMenuItem} ] }); var editMenu = new Ext.menu.Menu({ items: [ {text:"剪切", handler:onMenuItem}, {text:"复制", handler:onMenuItem}, {text:"粘贴", handler:onMenuItem} ] }); var themeMenu = new Ext.menu.Menu({ items: [ {id:"default", text:"默认", checked:true, group:"theme", checkHandler:onItemCheck}, {id:"red", text:"红色", checked:false, group:"theme", checkHandler:onItemCheck}, {id:"green", text:"绿色", checked:false, group:"theme", checkHandler:onItemCheck}, {id:"gray", text:"灰色", checked:false, group:"theme", checkHandler:onItemCheck}, "-", {text:"禁用", checked:false, checkHandler:onCheckboxItem} ] }); var scrollMenu = new Ext.menu.Menu({ maxHeight: 200, showSeparator: false }); for (var i = 0; i < 50; ++i){ scrollMenu.add({ text: 'Item ' + (i + 1) }); } var t3 = new Ext.Toolbar({ items:[ {text:"文件", menu:fileMenu}, {text:"编辑", menu:editMenu}, {text:"主题", menu:themeMenu}, "-", {id:"add", text:"新建", iconCls:"add", enableToggle:true, toggleHandler:onToggleHandler}, {id:"save", text:"保存", iconCls:"save", handler:onToolbarButton}, {id:"delete", text:"删除", iconCls:"delete", handler:onToolbarButton}, {icon:"../images/toolbar/help.gif", tooltip:"帮助文档"}, {xtype:"splitbutton", text:"滚动菜单", menu:scrollMenu}, "-", {xtype:"textfield", width:100}, "->", { text:"enabled", handler: function(){ if(currnetItem!=null && currnetItem.enable){ currnetItem.setDisabled(false); currnetItem = null; alert(currnetItem); } } }, "-", "工具条" ] }); new Ext.Panel({ title: "普通工具条", renderTo: "div1", frame: true, width: 700, tbar: t3, bodyStyle: "background-color:#FFFFFF; height:50; padding:3px;", html: "当在工具条中同时出现Menu和Element时,会导致Menu失灵。" }); //单击工具条上的按钮时触发该函数 function onToolbarButton(btn){ alert(btn.id); } //单击菜单项时触发该函数 function onMenuItem(item){ alert(item.text); //item.setDisabled(true); //currnetItem = item; } //checked的值变化时触发该函数 function onItemCheck(item, checked){ if(checked) alert(item.text); } function onCheckboxItem(item){ themeMenu.get("default").setDisabled(item.checked); themeMenu.get("red").setDisabled(item.checked); themeMenu.get("green").setDisabled(item.checked); themeMenu.get("gray").setDisabled(item.checked); } function onToggleHandler(item, pressed){ alert(pressed); } });
3、分组工具条
- Ext.onReady(function(){
- Ext.BLANK_IMAGE_URL = "../widgets/ext-3.0/resources/images/default/s.gif";
- //菜单工具条
- var fileMenu = new Ext.menu.Menu({
- shadow: "sides",
- items: [{text:"新建"}, {text:"打开"}, "-", {text:"关闭"}]
- });
- var editMenu = new Ext.menu.Menu({
- items: [{text:"剪切", iconCls:"cut"}, {text:"复制", iconCls:"copy"}, {text:"粘贴", iconCls:"paste"}]
- });
- var g1 = {
- xtype: "buttongroup",
- title: "菜单",
- columns: 3,
- defaults: {
- scale: "small", //small, medium, large
- iconAlign: "top"
- },
- items: [
- {xtype:"splitbutton", text:"文件", menu:fileMenu, iconCls:"add", rowspan:1, arrowAlign:"bottom"},
- {xtype:"splitbutton", text:"编辑", menu:editMenu, iconCls:"save", rowspan:1, arrowAlign:"bottom"},
- {text:"查看", iconCls:"search", scale: "large"}
- ]
- };
- var g2 = {
- xtype: "buttongroup",
- title: "返回",
- columns: 1,
- defaults: {
- scale: "large",
- iconAlign: "top"
- },
- items: {text:"返回", iconCls:"back"}
- };
- var g3 = {
- xtype: "buttongroup",
- title: "剪贴板",
- defaults: {
- scale: "large",
- iconAlign: "top"
- },
- items: [
- {text:"剪切", iconCls:"cut"},
- {text:"复制", iconCls:"copy"},
- {text:"粘贴", iconCls:"paste"}
- ]
- };
- var g4 = {
- xtype: "buttongroup",
- title: "帮助",
- defaults: {
- scale: "small"
- },
- height: 80,
- items: [
- {xtype:"splitbutton", text: "帮助", iconCls:"help"}
- ]
- };
- var panel = new Ext.Panel({
- title: "分组工具条",
- renderTo: "div1",
- frame: true,
- width: 600,
- height: 300,
- autoScroll: true,
- tbar: [g1, g3, g2, g4],
- bodyStyle: "background-color:#FFFFFF; padding:3px;",
- autoLoad: "messagebox.action"
- });
- });
Ext.onReady(function(){ Ext.BLANK_IMAGE_URL = "../widgets/ext-3.0/resources/images/default/s.gif"; //菜单工具条 var fileMenu = new Ext.menu.Menu({ shadow: "sides", items: [{text:"新建"}, {text:"打开"}, "-", {text:"关闭"}] }); var editMenu = new Ext.menu.Menu({ items: [{text:"剪切", iconCls:"cut"}, {text:"复制", iconCls:"copy"}, {text:"粘贴", iconCls:"paste"}] }); var g1 = { xtype: "buttongroup", title: "菜单", columns: 3, defaults: { scale: "small", //small, medium, large iconAlign: "top" }, items: [ {xtype:"splitbutton", text:"文件", menu:fileMenu, iconCls:"add", rowspan:1, arrowAlign:"bottom"}, {xtype:"splitbutton", text:"编辑", menu:editMenu, iconCls:"save", rowspan:1, arrowAlign:"bottom"}, {text:"查看", iconCls:"search", scale: "large"} ] }; var g2 = { xtype: "buttongroup", title: "返回", columns: 1, defaults: { scale: "large", iconAlign: "top" }, items: {text:"返回", iconCls:"back"} }; var g3 = { xtype: "buttongroup", title: "剪贴板", defaults: { scale: "large", iconAlign: "top" }, items: [ {text:"剪切", iconCls:"cut"}, {text:"复制", iconCls:"copy"}, {text:"粘贴", iconCls:"paste"} ] }; var g4 = { xtype: "buttongroup", title: "帮助", defaults: { scale: "small" }, height: 80, items: [ {xtype:"splitbutton", text: "帮助", iconCls:"help"} ] }; var panel = new Ext.Panel({ title: "分组工具条", renderTo: "div1", frame: true, width: 600, height: 300, autoScroll: true, tbar: [g1, g3, g2, g4], bodyStyle: "background-color:#FFFFFF; padding:3px;", autoLoad: "messagebox.action" }); });
相关推荐
65、Ext.Toolbar.Separator类 ……… 56 66、Ext.Toolbar.Spacer类 …………… 56 67、Ext.Toolbar.TextItem类 ……… 56 68、Ext.Toolbar.Fill类 ……………… 56 69、Ext.grid.ColumnModel类 ……… 58 70、Ext....
ext Panel+toolbar+button 实作带注释 Tom 实作实例,推荐入门学习,不带Ext js lib,请自行加入
65、Ext.Toolbar.Separator类 ……… 56 66、Ext.Toolbar.Spacer类 …………… 56 67、Ext.Toolbar.TextItem类 ……… 56 68、Ext.Toolbar.Fill类 ……………… 56 69、Ext.grid.ColumnModel类 ……… 58 70、Ext....
第十二章 Ext.toolbar.Toolbar 工具栏、Ext.toolbar.Paging 分页栏、Ext.ux.statusbar.StatusBar 状态栏 103 一、Ext.toolbar.Toolbar 103 二、Ext.toolbar.Paging 115 三、Ext.ux.statusbar.StatusBar 122 第十三章...
Ex4.0共2个压缩包特性,《ext js权威指南》 前 言 第1章 ext js 4开发入门 / 1 1.1 学习ext js必需的基础知识 / 1 1.2 json概述 / 3 1.2.1 认识json / 3 1.2.2 json的结构 / 3 1.2.3 json的例子 / 4 1.2.4 ...
var system_add_rent = new Ext.Toolbar({ border : false, items : [{ text : "添加月租金", iconCls : "add10", listeners : { click : function() { add_rent.show(); } ...
3.4.1 认识Ext.toolbar.Toolbar 3.4.2 只包含按钮的简单工具栏 3.4.3 包含多种元素的复杂工具栏 3.4.4 启用和禁用工具栏 3.4.5 认识Ext.menu.Menu菜单 3.4.6 最简单的菜单栏 3.4.7 创建二级或多级菜单 3.4.8 ...
5.4.1 Ext.Toolbar简介 5.4.2 只包含按钮的简单工具栏 5.4.3 包含多种元素的复杂工具栏 5.4.4 Ext.menu.Menu简介 5.4.5 最简单的菜单栏 5.4.6 创建三级或多级菜单 5.4.7 具有选择框的菜单 第6章 页面元素与...
5.4.1 Ext.Toolbar简介 5.4.2 只包含按钮的简单工具栏 5.4.3 包含多种元素的复杂工具栏 5.4.4 Ext.menu.Menu简介 5.4.5 最简单的菜单栏 5.4.6 创建三级或多级菜单 5.4.7 具有选择框的菜单 第6章 页面元素与...
Extjs面包屑添加一名作者我快速而肮脏地尝试制作 Extjs 面包屑扩展。 使用 Extjs 4.1.0 测试这里它运行在 jsfiddle.net 注意:这是为了在我正在从事的项目中具有我想要的功能而量身定制的。 所以我认为它的功能不像...
一、基础篇 1、Ext JS下载及配置 2、基本功能 2.1、Ext.MessageBox消息框 2.2、Ext.window.MessageBox 3、工具栏和菜单栏 3.1、Ext.toolbar.Toolbar工具栏 3.2、Ext.menu.Menu菜单栏 4、表单
首先在Ext.grid.GridPanel中必须要有tbar对象 然后要增加listeners: { ... //add three tbar } } 可以看到这里有bbar2这样就可以增加很多bar了 代码如下:this.bbar2 = new Ext.Toolbar({ renderTo: grid.tbar, items
function process(){ Ext.MessageBox.confirm('确认提示', '你确定要导出Excel吗?... window.open(_url, '_self','width=1,height=1,toolbar=no,menubar=no,location=no'); msgTip.hide(); } }) }
代码如下:/**模仿tabpanel导航栏*/Ext.define(‘ux.TabBar’, { alternateClassName: ‘tabBar’, extend: ‘Ext.Toolbar’, xtype: ‘tabBar’, config: { docked: ‘bottom’, cls: ‘navToolbar’, ...
extjs4.0 实现了主页面框架(主框架使用Ext.Viewport,banner使用Ext.panel.Panel,通过toolbar来放置按钮),包括左侧动态菜单实现(采用Ext.tree.Panel)动态从数据库加载数据来显示菜单(后台代码也在了通过json...
this.KE.toolbar.disable(this.tid, []); this.KE.readonly(this.tid); this.KE.g[this.tid].newTextarea.disabled = true; }, onEnable: function () { this.KE.toolbar.able(this.tid, []); this.KE....
下面是一个例子: 代码如下: [removed] Ext.onReady(function() { var tb = new Ext.Toolbar({ renderTo: document.body, width: 600, height: 100, items: [ { // xtype: ‘button’, // default for Toolbars, ...
xtype:在EXTJS的可视化组件部署中的一种机制,即通过指定xtype的值,来告诉容量如何初始化所包含的级件,如xtype:”textfiled”,表示使用Ext.form.TextFile来进行初始化当前组件。 xtype Class ————- ————...
ExtAspNet - ExtJS based ASP.NET Controls with Full AJAX Support ExtAspNet是一组专业的Asp.net控件库,拥有原生的AJAX支持和丰富的UI效果, 目标是创建没有ViewState,没有JavaScript,没有CSS,没有...
* Enhanced Button and Toolbar components * ARIA/Section 508 accessibility improvements * CSS updates for reset style scoping and easier custom theming * Update the Ext event registration model * Ext....