1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    82
    Vote Rating
    0
    safewolf is on a distinguished road

      0  

    Default Extend a own class, how to have own property?

    Extend a own class, how to have own property?


    if i extend a own class like this

    Code:
    OwnClass = function(){
       .......
    }
    
    Ext.extend(OwnClass, Ext.someclass)
    how to add my own property so that i can instant like this

    Code:
    new OwnClass({MyProperty1:property1,MyProperty2:property2})

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,803
    Vote Rating
    606
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    Foo = Ext.extend(Bar,
    {
       prop1: 'foo',
       prop2: 'bar',
    
       //others
    }
    );
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    82
    Vote Rating
    0
    safewolf is on a distinguished road

      0  

    Default


    i have tried this,but i can't set the value of the properties,
    this is my code:

    Code:
    MyPanel = function(){
    	 MyPanel.superclass.constructor.call(this, {
    	 title: "ddd",
    	 height: 400,
    	 width:500
    	 });
    	 
    	 }
    	 
    Ext.extend(MyPanel, Ext.Panel,
    	{
    		mystr : "string_1"
    	}
    
    );
    
    
    Ext.onReady(function()
    {
    	panel = new MyPanel({mystr : "string_2"});
    	alert(panel.mystr);
    	panel.render("my-div");
    }
    
    );
    when "panel.mystr" is alerted,it's still "string_1",haven't changed to the given "string_2"

  4. #4
    Sencha User
    Join Date
    Mar 2008
    Posts
    82
    Vote Rating
    0
    safewolf is on a distinguished road

      0  

    Default


    found the problem

    the given properties should be applied before use

    so the code should be:

    Code:
    MyPanel = function(config){
          Ext.apply(this, config);
    	 MyPanel.superclass.constructor.call(this, {
    	 title: "ddd",
    	 height: 400,
    	 width:500
    	 });
    	 
    	 }
    	 
    Ext.extend(MyPanel, Ext.Panel,
    	{
    		mystr : "string_1"
    	}
    
    );
    
    
    Ext.onReady(function()
    {
    	panel = new MyPanel({mystr : "string_2"});
    	alert(panel.mystr);
    	panel.render("my-div");
    }
    
    );

  5. #5

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi