资源描述:
《extjs入门案例大全》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Ext.onReady(function(){varcm=newExt.grid.ColumnModel([{header:'编号',dataIndex:'id'},{header:'名称',dataIndex:'name'},{header:'描述',dataIndex:'descn'}]);vardata=[['1','name1','descn1'],['2','name2','descn2'],['3','name3','descn3'],['4','name4','descn4'],['5','name5','descn5']];var
2、ds=newExt.data.Store({proxy:newExt.data.MemoryProxy(data),reader:newExt.data.ArrayReader({},[{name:'id'},{name:'name'},{name:'descn'}])});ds.load();vargrid=newExt.grid.GridPanel({ds:ds,cm:cm,width:300,height:400,renderTo:'grids',tbar:[{xtype:'datefield'}]});grid.render();});E
3、xt.onReady(function(){newExt.Panel({renderTo:"hello",title:"第一个",width:300,height:300,html:'
HelloWorld
'});});TabControlExt.onReady(function(){newExt.TabPanel({renderTo:"hello",width:300,height:200,items:[newExt.Panel({title:"面板1",height:30}),newExt.Panel({title:"面板2"
4、,height:30}),newExt.Panel({title:"面板3",height:30})]});});总结:Ext.onReady(function(){newExt.Panel({renderTo:"hello",title:"面板",html:'面板内容',height:100,width:200});});创建按钮事件:newExt.Button({renderTo:"hello",text:"添加",pressed:true,height:30,handler:Ext.emptyFn});newExt.Viewp
5、ort({layout:"border",items:[{region:"north",title:"面板",html:"面板内容",height:300,width:500},{region:"center",xtype:"grid",title:"学生信息管理",autoExpandColumn:3}]});functiona(){alert('something');}window.onload=function(){document.getElementById("btnAlert").onclick=a;}6、xt/javascript">functiona(){alert('something');}Ext.onReady(function(){Ext.get('btnAlert').on('click',a);Ext.get('btnAlert').addListener('click',a);});functiona(){alert('something');}Ext.onReady(function(){Ext.get('btnAlert').on("click",a,this,{delay:20000});});//用ext
7、js增加事件监听器varwin=newExt.Window({title:"不能关闭地窗口",height:200,width:300,listeners:{"beforedestroy":function(obj){alert("想关闭我,这是不可能地!");obj.show();returnfalse;}}});win.show();//面板工具栏中放按钮newExt.Panel({renderTo:"hello",title:"面板头部header",width:300,height:200,html:'
面板主区域
',tb
8、ar:[{pressed:true,text:'刷新'},],bbar:[{text:'底部工具栏bottomToolBar'}],bu