Results 1 to 2 of 2

Thread: reference container config inside items config

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    52
    Answers
    4
    Vote Rating
    2
      0  

    Default 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
    100
      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
    });

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •