extjs中Toolbar工具栏的用法
来源:互联网 发布:手绘板绘图软件 编辑:程序博客网 时间:2024/05/17 01:11
文章转载于:extjs中Toolbar工具栏 http://www.studyofnet.com/news/159.html
extjs中Ext.toolbar.Toolbar可以用来放置一些工具类操控按钮和菜单,工具栏控件可以被附加在面板、窗口等容器类控件中,可以在四个方位添加多个工具栏控件。
<script type="text/javascript"> Ext.onReady(function() { var toolbar = new Ext.toolbar.Toolbar({ renderTo:Ext.getBody(), width:500 }); toolbar.add( {text:'新建'},{text:'打开'}, {text:'编辑'},{text:'保存'},//加入按钮 '-', {//加入表单元素 xtype:'textfield', hideLabel:true, width:150 }, '->', '<a href=#>超链接</a>', {xtype:'tbspacer',width:50}, '静态文本' ); }); </script>
效果图
Ext.toolbar.Toolbar的overflowHandler属性实例:
如果工具栏上的item项目过多,而面板的长度不够那会怎么样?我们需要设置 overflowHandler: 'Menu'
效果图
动态工具栏添加项:
//创建母工具栏 var toolbar = Ext.create('Ext.toolbar.Toolbar', { renderTo: document.body, width: 700, items: [ { text: 'Example Button' } ] });var addedItems = []; //添加项数组Ext.create('Ext.toolbar.Toolbar', { renderTo: document.body, width: 700, margin: '5 0 0 0', items: [ { text: 'Add a button', scope: this, handler: function () { var text = prompt('Please enter the text for your button:'); addedItems.push(toolbar.add({ //装入 text: text })); } }, { text: 'Add a text item', scope: this, handler: function () { var text = prompt('Please enter the text for your item:'); addedItems.push(toolbar.add(text)); } }, { text: 'Add a toolbar seperator', scope: this, handler: function () { addedItems.push(toolbar.add('-')); } }, { text: 'Add a toolbar spacer', scope: this, handler: function () { addedItems.push(toolbar.add('->')); } }, '->', { text: 'Remove last inserted item', scope: this, handler: function () { if (addedItems.length) { toolbar.remove(addedItems.pop()); } else if (toolbar.items.length) { toolbar.remove(toolbar.items.last()); } else { alert('No items in the toolbar'); } } }, { text: 'Remove all items', scope: this, handler: function () { toolbar.removeAll(); } } ] });
效果图:
- extjs中Toolbar工具栏的用法
- ExtJs 入门教程十六[工具栏 :Toolbar]
- 工具栏ToolBar的使用
- (5)ExtJS之工具栏toolbar 1
- (6)ExtJS之工具栏toolbar 2
- EXTJS 中toolbar换行
- GTK+中工具栏(Toolbar)使用说明
- 在对话框中创建工具栏ToolBar
- QtDesigner中如何手动添加工具栏toolBar
- How to set Extjs Toolbar items' width to expand the whole 工具栏项的宽度设为百分比
- extjs中Toolbar的items元素,可以设置宽度么
- Ext.toolbar.Toolbar工具栏
- Ext.toolbar.Toolbar 工具栏
- Ext.toolbar.Toolbar工具栏
- ExtJs中Grid的用法
- EXTJS 中 anchor 的用法
- EXTJS中store的用法
- Extjs中apply的用法
- analysis of ShadowMapping Sample with GLSL
- Hibernate--hibernate.hbm2ddl.auto配置详解
- android adb shell 命令大全
- flash and vc++制作精美界面程序
- Agri-Net
- extjs中Toolbar工具栏的用法
- mysql的python api
- 测试
- 获取浏览器窗口的高度和宽度
- IOS深入学习(19)之View object
- 开发QQ互联android版Ane扩展 遇到几个典型问题
- access函数
- 浅谈深度学习(Deep Learning)的基本思想和方法
- 卡塔兰数