日期:2014-05-16  浏览次数:20372 次

ExtJs 开发笔记
1: 向Ext对象中动态添加Item:

http://topic.csdn.net/u/20081014/23/c4e9b7c4-5941-452b-8f65-a50680d1ed2f.html

Ext.getCmp('compId').add(newItem).show();
Ext.getCmp('compId').doLayout();


下面的方法是不行的:
Ext.getCmp('compId').add(newItem);


2: Ext.Window 关闭时出错:
       var win2AddDxSubject = null;
        function openAddDxSubjectWin() {
        	if (win2AddDxSubject == null) {
        		win2AddDxSubject = new Ext.Window({
        			applyTo:'hello-win',
               		layout:'fit',
	                width:500,
	                height:300,
	                closeAction:'hide',
	                autoDistroy:false,
	                closable:true,
	                plain: true,
	                
	                buttons: [{
	                    text:'添加',
	                    disabled:true
	                },{
	                    text: '取消',
	                    handler: function(){
	                        win2AddDxSubject.hide(); 
	                    }
	                }]
        		});
        	}
        	
        	win2AddDxSubject.show(); 

打开Window对象是,不要使用方式:  win2AddDxSubject.show(this);
如果非要用这种方式打开, 则关闭时使用:   win2AddDxSubject.hide(this);
并且 closable 要设置成false, 否则点击右上角的 '×' 时会报JS错。


3. 可编辑的 Ext.grid.EditorGridPanel:
http://topic.csdn.net/u/20100520/08/89657fab-ab54-4dbf-9d15-6b1393cc868d.html

4. 各种panel,设置属性 frame:true 背景会变成淡蓝色

5. 遍历JS对象中的全部属性
<script>
var obj = {a:1,b:2,c:3}
for(var s in obj)
alert(obj[s]);
</script>



6. 重新布局函数  doLayout