Ext.onReady(function(){
var toolbar=new Ext.toolbar.Toolbar({
renderTo:'toolbar',
width:600
});
toolbar.add([
{
text:'新建',
handler:onButtonClick
},
{
text:'打开'
},
{
text:'编辑'
},
{
text:'保存'
},
'-',
{
xtype:'textfield',
hideLabel:true,
width:150
},
'->',
'<a href=#>超链接</a>',
{
xtype:'tbspacer',
width:50
},
'静态文本'
]);
function onButtonClick(btn){
Ext.MessageBox.alert('结果','您点击的是:'+btn.text);
}
var enableTool=new Ext.Button({
text:'启用工具栏',
renderTo:'enabletool',
handler:function(){
toolbar.enable();
}
});
var disableTool=new Ext.Button({
text:'禁用工具栏',
renderTo:'disabletool',
handler:function(){
toolbar.disable();
}
});
});
Ext.onReady(function(){
var toolbar=new Ext.Toolbar({
renderTo:'toolbar',
width:300
});
var fileMenu=new Ext.menu.Menu({
shadow:'frame',
allowOtherMenus:true,
items:[
new Ext.menu.Item({
text:'新建',
handler:onMenuItem
}),
{
text:'打开',
handler:onMenuItem
},
{
text:'关闭',
handler:onMenuItem
}
]
});
var editMenu=new Ext.menu.Menu({
shadow:'drop',
allowOtherMenus:true,
items:[{
text:'复制',
handler:onMenuItem
},{
text:'粘贴',
handler:onMenuItem
},{
text:'剪切',
handler:onMenuItem
}
]
});
toolbar.add({text:'文件',menu:fileMenu},
{text:'编辑',menu:editMenu});
function onMenuItem(item){
Ext.MessageBox.alert('结果','您选择了'+item.text);
};
});
Ext.onReady(function(){
var Toolbar=new Ext.Toolbar({
renderTo:'toolbar',
width:300
});
var infoMenu=new Ext.menu.Menu({ //一级菜单
ignoreParentClicks:true, //忽略父菜单的单击事件
plain:true,
items:[{
text:'个人信息',
menu:new Ext.menu.Menu({ //二级菜单
ignoreParentClicks:true, //忽略父菜单的单击事件
items:[{
text:'基本信息',
menu:new Ext.menu.Menu({ //三级菜单
items:[{
text:'身高',
handler:onMenuItem
},{
text:'体重',
handler:onMenuItem
}
]
})
}]
})
},{
text:'公司信息'
}]
});
Toolbar.add({
text:'设置',
menu:infoMenu
});
function onMenuItem(item){
Ext.MessageBox.alert('结果','您选择了:'+item.text);
}
});
Ext.onReady(function(){
var Toolbar=new Ext.Toolbar({ //创建工具栏
renderTo:'toolbar',
width:300
});
var fileMenu=new Ext.menu.Menu({ //创建文件菜单
items:[{
xtype:'textfield', //创建表单字段
hideLabel:true,
width:100
},{
text:'颜色选择',
menu:new Ext.menu.ColorPicker()
},{
xtype:'datepicker' //添加日期选择器组件
},{
xtype:'buttongroup', //添加按钮
columns:3,
title:'按钮组',
items:[{
text:'用户管理',
scale:'large',
colspan:3,
width:170,
iconAlign:'top'
},{
text:'新建',
},{
text:'打开'
},{
text:'保存'
}]
}]
});
var themeMenu=new Ext.menu.Menu({ //创建主题菜单
items:[{
text:'主题颜色',
menu:new Ext.menu.Menu({
items:[{
text:'红色主题',
checked:true, //初始为选中状态
group:'theme', //为单选想进行分组
checkHandler:onItemCheck
},{
text:'蓝色主题',
checked:false,
group:'theme',
checkHandler:onItemCheck
},{
text:'黑色主题',
checked:false,
group:'theme',
checkHandler:onItemCheck
}]
})
},{
text:'是否启用',
checked:false
}]
});
Toolbar.add( //将菜单加入工具栏
{
text:'文件',menu:fileMenu
},{
text:'风格选择',menu:themeMenu
}
);
function onItemCheck(item){ //菜单项的回调方法
Ext.MessageBox.alert('结果',item.text); //取得菜单项的text属性
}
});
详细解决方案
extjs4学习2
热度:82 发布时间:2012-09-10 11:02:32.0
相关解决方案
- ExtJS4.0 文件上传的返回JSON字符串不对,该如何解决
- ()extjs4.0 mvc模式中,在controller中获取view层的元素对象
- extjs4.0 多条件检索
- ExtJs4 将Grid的状态保留到服务器端
- EXTJS4 tabpanel选项卡里面的面板不显示滚动条
- ExtJs4.1的有关问题,求大牛帮忙看下
- extjs4.0表格行双击不响应
- extjs4 gridpanel 行边框如何变色
- extjs4.0 form数据加载有关问题
- extjs4.1 form交付时waitMsg的样式
- ExtJS4.x设立表单中控件为可用
- ExtJS4.0 资料上传的返回JSON字符串不对
- Extjs4 Store B删除Store A解决思路
- 求教 extjs4 点击树节点 新建tab并加载不同的grid解决思路
- ExtJS4.0 文件下传的返回JSON字符串不对
- extjs4.0下传有关问题 SSH+extjs4.0
- extjs4 tree如何判断一棵树没有选中任何节点?
- ExtJs4 ComboBox级联解决办法
- Extjs4.0的API怎样才能在页面上能够全部显示出来?解决方案
- extjs4.0中点击gird中某一列,怎么跳转至一个新的界面呢
- Extjs4.0中grid表格没有数据?解决方法
- extjs4 怎样让子容器控制父容器的高度解决方案
- Extjs4 Web Application Development Cookbook学习札记四
- Extjs4 添多个tbar
- Extjs4 gridPanel 列依照百分比分配宽度
- Extjs4 简略的Tree panel树例子
- ExtJS4.1点染不到界面上
- ExtJs4.0 grid报表不显示数据
- extjs4 refs中配置ref,没法获取get方法
- Extjs4.2关于combobox透过direct绑定服务器数据