-
26 Oct 2007 8:07 AM #1
What is different between two way to add new vars/function into new class?
What is different between two way to add new vars/function into new class?
alert shows "i'm new var! and i'm new var2!"Code:Ext.myPanel = function(config){ this.newVar = 'i\'m new var!'; this.newFunction = function(){ alert(this.newVar + ' and ' + this.newVar2); } Ext.myPanel.superclass.constructor.call(this, config); } Ext.extend(Ext.myPanel, Ext.Panel, { newVar2: 'i\'m new var 2!', newFunction2: function(){ this.newFunction(); } }); Ext.onReady(function(){ var p = new Ext.myPanel({ config }); p.newFunction2(); });
... both works fine


Reply With Quote