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

      0  

    Default Unanswered: reference container config inside items config

    Unanswered: reference container config inside items config


    I have a custom config that I want to reference inside the items config of a container. How do I do this?

    Code:
    Ext.define( 'App.view.View',{
    	extend: 'Ext.Container',
    	config:
    	{
    		model: null, //Custom config
    		items:
    		[
    		{
    			title: 'Nested View',
    			xtype: 'view',
    			record: this.getModel() //How do I reference my custom config model here?
    		}
    		]
    	}
    } );

  2. #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 try something like this:
    Code:
    Ext.define('App.view.View',{
        extend: 'Ext.Container',
        config:
        {
             //...
        },
        initialize: function(){
            var me = this,
                c  = me.config;
            
            me.add({
                title: 'Nested View',
                xtype: 'view',
                record: c.model
            });
            
            me.callParent(arguments);
        }
    });
    You can set your custom model config when using Ext.create()
    Code:
    Ext.create('App.view.View', {
        model: //reference your model here
    });

Thread Participants: 1

Tags for this Thread