tbar和btn数据组合写tbar的效果还有其分割线的实现

在实际的项目开发中我们经常会遇到一个panel或者window容器里面放置tbar并且放入好多个按钮,我要写的就是这样的一个例子

最终效果截图:

1、定义按钮组合

var btns=[ { id:'hidebtn', text:TxtForFunction.hid, //隐藏条件 iconCls:'HideConditions', toolTip:TxtForFunction.hid, handler: function(){ alert('隐藏条件'); } },{ id:'searchbtn', text:TxtForFunction.search, //筛选 iconCls:'HideConditions', toolTip:TxtForFunction.search, handler: function(){ alert('筛选'); } },{ id:'resetbtn', text:TxtForFunction.reset, //重置 iconCls:'HideConditions', toolTip:TxtForFunction.reset, handler: function(){ alert('重置'); } },{ id:'hidebtn', text:TxtForFunction.add, //新增 iconCls:'HideConditions', toolTip:TxtForFunction.add, handler: function(){ alert('新增'); } },{ id:'hidebtn', text:TxtForFunction.savelink, //保存 iconCls:'HideConditions', toolTip:TxtForFunction.savelink, handler: function(){ alert('保存'); } },{ id:'hidebtn', text:TxtForFunction.deletelink, //删除 iconCls:'HideConditions', toolTip:TxtForFunction.deletelink, handler: function(){ alert('删除'); } },{ id:'hidebtn', text:TxtForFunction.detaillink, //详细设定 iconCls:'HideConditions', toolTip:TxtForFunction.detaillink, handler: function(){ alert('详细设定'); } },{ id:'hidebtn', text:TxtForFunction.idforfunction, //功能ID设定 iconCls:'HideConditions', toolTip:TxtForFunction.idforfunction, handler: function(){ alert('功能ID设定'); } }] 2、定义tbar的时候只要将btns数组放进去就可以了写法如下: Ext.onReady(function(){ var panel=new Ext.Panel({ renderTo:'hello', title:'test', html:'aaaa', width:600, height:400, tbar:[btns] }); });

3、分割线的写法:

在这里我们需要注意的是xtype如果为tbseparator的话,这样就有两个按钮中间的分割线,要不然是没有的

面板属性解析:
tools:工具栏

这个工具栏说的是标题上的按钮

tbar:[new Ext.Toolbar.TextItem('工具栏'), {xtype:"tbfill"}, {pressed:"true",text:"添加"}, {xtype:"tbseparator"}, {pressed:"true",text:"保存"} ]

这个tbar说的是标题栏下面的这个工具栏





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值