function(){
Ext.MessageBox.alert("hello","hello,my frist Extjs!!!");
}
Ext.onReady(function(){
var win = new Ext.Window({title:"hello",width:300,height:300,html:'<h1>hillo,i study extjs frist!!!</h1>'});
win.show();
});
new Ext.Button({renderTo:"hello", text:"添加", pressed:true, heigth:30, handler:Ext.emptyFn });
var win = new Ext.Window({title:"li",width:200,height:300,html:'hi'});
win.show();
Ext.onReady(
function(){
var obj= new Ext.Panel({title:"hello",width:300,height:200,html:'hello,i love study'});
obj.render("hello");
<div id="hello"> </div>
});
new Ext.Panel({
renderTo:"hello",
title:"李红琼的信息",
width:300,
layout:"form",
hideLabels:false,
labelAlign:"right",
height:120,
defaultType:'textfield',
items:[
{fieldLabel:"请输入姓名",name:"name"},
{fieldLabel:"请输入地址",name:"address"},
{fieldLabel:"请输入电话",name:"tel"}
]
});
new Ext.Panel({
renderTo:"hello",
title:"李红琼独立开发",
layout:"column",
width:500,
height:100,
items:[{title:"李红琼名",width:100},
{title:"love",width:100},
{title:"yang",width:100},
{title:"no"}
]
});
var panel=new Ext.Panel({
renderTo:"hello",
title:"li",
width:500,
height:200,
layout:"table",
layoutConfig: {
columns:3
},
items:[{title:"1",html:"konw",rowspan:2,height:100},
{title:"2",html:"konw2",colspan:2},
{title:"3",html:"konw3"},
{title:"4",html:"konw4"}
]
}
);
renderTo:"hello",
title:"组建",
width:500,
height:200,
layout:"table",
layoutConfig: {
columns:3
},
items:[{title:"元素一",html:"内容",rowspan:2,height:100},
{title:"元素二",html:"内容",colspan:2},
{title:"元素三",html:"3"},
{title:"go",html:"id"}
]
}
);
var i=0,mygroup;
function newWin(){
var win=new Ext.Window({
title:"窗口李"+i++,
width:400,
height:300,
maximizable:true,
manager:mygroup
});
win.show();
}
function toBack(){
mygroup.sendToBack(mygroup.getActive());
}
function hideAll(){
mygroup.hideAll();
}
Ext.onReady(function(){
mygroup =new Ext.WindowGroup();
Ext.get("btn").on("click",newWin);
Ext.get("btnToBack").on("click",toBack);
Ext.get("btnHide").on("click",hideAll);
});
<input name="add" type="button" value="新窗口" id="btn">
<input name="add" type="button" value="放后台" id="btnToBack">
<input name="add" type="button" value="隐藏所有" id="btnHide">
Ext.get("btnAlert").on("click",function(){
Ext.MessageBox.alert("请注意","你好我还在这儿");
});
<input type="button" value="alert" id="btnAlert">
new Ext.Panel({
renderTo:"hello",
title:"hello",
width:400,
height:200,
html:'还好现在的我',
tools:[{
id:"save"
},
{id:"help",handler:function(){Ext.Msg.alert('help','i love myself');}},
{id:"close"}
],
tbar:[{pressed:true,text:'刷新'}]
});
new Ext.Panel({
renderTo:"hello",
title:"hello",
width:300,
height:200,
html:'i love me',
tbar:[new Ext.Toolbar.TextItem('工具栏'),
{xtype:"tbfill"},
{pressed:true,text:'添加'},
{xtype:"tbseparator"},
{pressed:true,text:'保存'}
]
});
var data=[[1,'web','easy','www.lhq.com'],
[2,'web','easy','www.lhq.com'],
[3,'web','easy','www.lhq.com'],
[4,'web','easy','www.lhq.com'],
[5,'web','easy','www.lhq.com']
];
var store =new Ext.data.SimpleStore({data:data,fields:["id","name","organization","homepage"]});
var grid=new Ext.grid.GridPanel({
renderTo:"hello",
title:"中国团队",
height:150,
width:600,
columns:[{header:"项目id",dataIndex:"id"},{header:"项目名称",dataIndex:"name"},
{header:"开发团队",dataIndex:"organization"},
{header:"网址",dataIndex:"homepage"}
],
store:store,
autoExpandColumn:2
});
function showUrl(value){
return ""+value+"";
}
Ext.onReady(function(){
var data=[[1,'loveextjs','lihongqiong','www.baidu.com'],
[2,'jfox','lison','www.lhq.com'],
[3,'loveextjs','lihongqiong','www.lhq.com'],
[4,'loveextjs','lihongqiong','www.lhq.com'],
[5,'loveextjs','lihongqiong','www.lhq.com']
];
var store= new Ext.data.SimpleStore({data:data,fields:["id","name","pul","home"]});
var colM=new Ext.grid.ColumnModel([
{header:"项目名称",dataIndex:"name",sortable:true},
{header:"开发团队",dataIndex:"pul",sortable:true},
{header:"网址",dataIndex:"home",renderer:showUrl}
]);
var grid=new Ext.grid.GridPanel({
renderTo:"hello",
title:"中国开发团队",
height:200,
width:600,
cm:colM,
store:store,
autoExpandColumn:2
});
});
var data=[{id:1,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'},
{id:2,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'},
{id:3,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'}
] ;
var store =new Ext.data.JsonStore({
data:data,
fields:["id","name","sex","email",{name:"bornDate",type:"date",dateFormat:"Y-n-j"}]
});
var colM=new Ext.grid.ColumnModel([{
header:"姓名",
dataIndex:"name",
sortable:true,
editer:new Ext.form.TextField()
},
{
header:"性别",
dataIndex:"sex"},
{
header:"生日日期",
dataIndex:"bornDate",
width:120,
renderer:Ext.util.Format.dateRenderer('Y年m月d日')},
{
header:"电子邮箱",
dataIndex:"email",
sortable:true,
editer:new Ext.form.TextField()}
]);
var grid = new Ext.grid.EditorGridPanel({
renderTo:"hello",
title:"学生基本信息",
height:200,
width:600,
cm:colM,
store:store,
autoExpandColumn:3
});
var data=[{id:1,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'},
{id:2,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'},
{id:3,name:'wang',email:'wang@qq.com',sex:'男',bornDate:'1991-4-4'}
] ;
var store =new Ext.data.JsonStore({
data:data,
fields:["id","name","sex","email",{name:"bornDate",type:"date",dateFormat:"Y-n-j"}]
});
var colM=new Ext.grid.ColumnModel([{
header:"姓名",
dataIndex:"name",
sortable:true,
editer:new Ext.form.TextField()
},
{
header:"性别",
dataIndex:"sex",
editor:new Ext.form.ComboBox({
transform:"sexList",
triggerAction:'all',
lazyRender:true
})
},
{
header:"生日日期",
dataIndex:"bornDate",
width:120,
renderer:Ext.util.Format.dateRenderer('Y年m月d日'),
editor:new Ext.form.DateField({format:'Y年m月d日'})},
{
header:"电子邮箱",
dataIndex:"email",
sortable:true,
editer:new Ext.form.TextField()}
]);
var grid = new Ext.grid.EditorGridPanel({
renderTo:"hello",
title:"学生基本信息",
height:200,
width:600,
cm:colM,
store:store,
autoExpandColumn:3,
clicksToEdit:1
});
this.grid.on("afteredit",this.afterEdit,this);
afterEdit:function(obj){
var r = obj.record;
var id = r.get("id");
var name=r.get("name");
var c=this.record2obj(r);
var tree=this.tree;
var node=tree.getSelectionModel().getSelectedNade();
if(node && node.id!="root")c.parentId=node.id;
if(id=="-1" && name!=""){
topicCategoryService.addTopicCategory(c,function(id){
if(id)r.set("id",id);
if(!node)node=tree.root;
node.appendChild(new Ext.tree.TreeNode({
id:id,
text:c.name,
leaf:ture
}));
node.getUI().removeClass('x-tree-node-leaf');
node.getUI().addClass('x-tree-node-expanded');
node.expand();
});
}
else if(name!=""){
topicCategoryService.updateTopicCategory(r.get("id"),c,function(ret){
if(ret)tree.getNodeById(r.get("id")).setText(c.name);
});
}
}
function a(){
alert('some thing');
}
Ext.onReady(function(){
Ext.get("btAlert").addListener("click",a);
}); <input type="button" value="alert" id="btAlert" >
Ext.onReady(function(){
Ext.get("btAlert").on("click",a,this,{delay:3000});
var win =new Ext.Window({
title:"不能关闭的窗口",
height:200,
width:300
});
win.on("beforedestroy",function(obj){
alert("想关闭我不可能的");
obj.show();
return false;
});
win.show();
var win =new Ext.Window({
title:"不能关闭的窗口",
height:200,
width:300
});
win.on("beforedestroy",function(obj){
alert("想关闭我不可能的");
obj.show();
return false;
});
win.show();
new Ext.Viewport({
enableTabScroll:true,
layout:"fit",
items:[{
title:"面板",
html:"",
bbar:[{text:"按钮1"},
{text:"按钮2"}
]
}]
});
new Ext.Viewport({
enableTabScroll:true,
layout:"border",
items:[{
title:"面板",
region:"north",
height:50,
html:"<h1>网站后台管理系统</h1>"
},
{title:"菜单",
region:"west",
width:200,
collapsible:true,
html:"菜单栏"},
{
xtype:"tabpanel",
region:"center",
items:[{title:"面板一"},
{title:"面板2"}
]
}
]
});
new Ext.Viewport({ layout:"border", items:[ {
region:"north",
title:"面板",
html:"面板内容",
height:100},
{ region:"center",
xtype:"grid",
title:"学生信息管理",
store:store,
autoExpandColumn:3 } ]});
var data=[[1,'web','easy','www.lhq.com'],
[2,'web','easy','www.lhq.com'],
[3,'web','easy','www.lhq.com'],
[4,'web','easy','www.lhq.com'],
[5,'web','easy','www.lhq.com']
];
var store =new Ext.data.SimpleStore({data:data,fields:["id","name","organization","homepage"]});
var colM=new Ext.grid.ColumnModel([{
header:"项目名称",dataIndex:"name",sortable:true
},
{header:"项目tuandui",dataIndex:"organization",sortable:true},
{header:"网址",dataIndex:"homepage"}]
);
var grid =new Ext.grid.GridPanel({
renderTo:"hello",
title:"中国",
height:200,
width:600,
cm:colM,
store:store,
autoExpandColumn:2
});
new Ext.Panel({
renderTo:"hello",
width:500,
height:400,
layout:"column",
items:[{
columnWidth:.5,
title:"111"},
{columnWidth:.5,
title:"222"}]
});
new Ext.Panel({
renderTo:"hello",
title:"li",
width:300,
height:200,
items:[{title:"李红琼名",width:40},
{title:"love",width:40},
{title:"yang",width:40},
{title:"no"}
],
tbar:[{text:'顶部'}],
bbar:[{text:'底部'}],
buttons:[{text:'footer'}]
});
new Ext.Panel({
renderTo:"hello",
title:"li",
width:300,
height:200,
html:'主面板',
tbar:[{text:'顶部'}],
bbar:[{text:'底部'}],
buttons:[{text:'footer'}]
});
var st= new Ext.Panel({title:"hillo",width:100,height:200,html:'hi'});
st.render("hello");
var panel = new Ext.TabPanel({width:300,height:200,items:[new Ext.Panel({title:"面板1",height:30}),new Ext.Panel({title:"面板二",height:30}),new Ext.Panel({title:"面板三",height:30})]});
panel.render("hello");
var panel = new Ext.TabPanel({width:300,height:200,items:[new Ext.Panel({title:"面板1",height:30}),new Ext.Panel({title:"面板二",height:30})]});
panel.render("hello");
var n=new Ext.TabPanel({width:200,height:200,items:[new Ext.Panel({title:"hi",width:100,html:'no'}),new Ext.Panel({title:"no",width:100,html:'no'})]});
n.render("hello");
var b=new Ext.Button({
text:"添加",
pressed:true,
height:30,
handler:Ext.emptyFn
});
var panel=new Ext.Viewport({
layout:"border",
items:[{
region:"north",
title:"面板",
html:"面板内容",
height:100
},
{region:"center",
xtype:"grid",
title:"学生信息管理",
store:store,
cm:colM,
store:store,
autoExpandColumn:3
}
]
});
panel.show();
Ext.onReady(function(){
New Ext.Panel({renderTo:"hello",title:"hello",width:300,height:200,html:'my frist lover yangsheng'});
<div id="hello"> </div>
});