1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    52
    Answers
    4
    Vote Rating
    2
    michael.parrott is on a distinguished road

      0  

    Default Answered: dynamically add content to list

    Answered: dynamically add content to list


    Code:
    Ext.define("GS.view.Main", {    extend: 'Ext.Container',
    	xtype: 'main',
    	
        config:
    	{
    		items: [
    		{ 
    			xtype: 'list',
    			itemTpl: '{name}',
    			initialize: function()
    			{
    				this.callParent( arguments );
    				
    				var store = Ext.create( 'Ext.data.Store', { fields: [ 'name' ] } );
    				store.add( { name: 'test' } );
    				this.setStore( store );
    			}
    		}
    		]
        }
    });
    I'm trying to dynamically add content to a list, but for some reason I never see anything show up when I run this code, and I have no idea why. Any help?

  2. You can only use the initialize function when defining your own subclass. Check out this demo. It works there.

  3. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You can only use the initialize function when defining your own subclass. Check out this demo. It works there.

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    52
    Answers
    4
    Vote Rating
    2
    michael.parrott is on a distinguished road

      0  

    Default


    Thanks, that worked well. Do you know if it says anywhere in the documentation that you can only overwrite initialize when defining a class?

  5. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Well you can only overwrite if you are defining a subclass. When you use the shortcut like { xtype: '...', ... } you are basically calling Ext.create(), not Ext.define().

    Maybe you can use something like a listener for an 'init' event but I just stick with definitions.

Thread Participants: 1

Tags for this Thread

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..."