Ext.form.TextArea

Ext.ns('MyOwnForm');
    MyOwnForm.TextArea = Ext.extend(Ext.form.TextArea , {
        initComponent : function(){
            this.addEvents(
                'dblclick',
                'contextmenu'
            );
            MyOwnForm.TextArea.superclass.initComponent.apply(this,arguments);
           
        },
       
        onRender : function(){
            MyOwnForm.TextArea.superclass.onRender.apply(this,arguments);
            this.el.on("dblclick" , this.onDblClick , this);
            this.el.on("contextmenu" , this.onContextmenu , this);
        },
       
        onDblClick : function(){
            this.fireEvent("dblclick" , this);
        },
       
        onContextmenu : function(e){
            e.stopEvent();
            this.fireEvent("contextmenu" , this);
        }
    });
   
    Ext.reg('_ta' , MyOwnForm.TextArea);
   
    var _form = new Ext.form.FormPanel({
        frame : true,
        renderTo : Ext.getBody(),
        width : 300,
        height : 200,
        items : [{
            xtype : "_ta",
            fieldLabel : "details",
            listeners : {
                "contextmenu" : function(){
                    alert(123);
                },
               
                "dblclick" : function(){
                    alert(456);
                }
            }
        }]
    });


这个是自己扩展

来源:一起Ext
原文地址:http://www.17ext.com/showtopic-5878.aspx

posted @ 2010-05-10 22:55  夜色狼  阅读(1384)  评论(0)    收藏  举报