1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    85
    Vote Rating
    1
    KallDrexx is on a distinguished road

      0  

    Default Answered: How do I access custom properties on an extended/defined class?

    Answered: How do I access custom properties on an extended/defined class?


    I have the following class:

    Code:
    Ext.define('DocumentEditor.view.document.Details', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.documentdetails',
        title: 'Details',
    
    
        // Components
        propertiesView: null,
        editView: null,
    
    
        initComponent: function () {
            propertiesView = Ext.create("DocumentEditor.view.document.PropertiesView");
            editView = Ext.create("DocumentEditor.view.document.PropertiesEdit");
            editView.hide();
    
    
            this.items = [propertiesView, editView];
    
    
            this.callParent(arguments);
        }
    });
    In my controller I am have the following code to create it:

    Code:
        onPanelRendered: function () {
            // Create the detail panel and add it to the workspace as a tab
            detailPanel = Ext.create('DocumentEditor.view.document.Details');
    
    
            var workspace = Ext.ComponentQuery.query('#workspace');
            if (workspace.length == 0)
                throw "No workspace found";
    
    
            workspace[0].add(detailPanel);
            detailPanel.propertiesView.show();
        },
    The last line fails, because the detailPanel object does not have a propertiesView property, nor do I see it when I debug it in Chrome.

    How can I access the property?

  2. Try this:

    Code:
    Ext.define('DocumentEditor.view.document.Details', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.documentdetails',
        title: 'Details',
    
    
    
    
        // Components
        propertiesView: null,
        editView: null,
    
    
    
    
        initComponent: function () {
            this.propertiesView = Ext.create("DocumentEditor.view.document.PropertiesView");
            this.editView = Ext.create("DocumentEditor.view.document.PropertiesEdit");
            this.editView.hide();
    
    
    
    
            this.items = [this.propertiesView, this.editView];
    
    
    
    
            this.callParent(arguments);
        }
    });
    Code:
        onPanelRendered: function () {
            // Create the detail panel and add it to the workspace as a tab
            this.detailPanel = Ext.create('DocumentEditor.view.document.Details');
    
    
    
    
            var workspace = Ext.ComponentQuery.query('#workspace');
            if (workspace.length == 0)
                throw "No workspace found";
    
    
    
    
            workspace[0].add(this.detailPanel);
            this.detailPanel.propertiesView.show();
        }

  3. #2
    Sencha User
    Join Date
    Jun 2009
    Posts
    102
    Vote Rating
    6
    Answers
    8
    campersau1 is on a distinguished road

      0  

    Default


    Try this:

    Code:
    Ext.define('DocumentEditor.view.document.Details', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.documentdetails',
        title: 'Details',
    
    
    
    
        // Components
        propertiesView: null,
        editView: null,
    
    
    
    
        initComponent: function () {
            this.propertiesView = Ext.create("DocumentEditor.view.document.PropertiesView");
            this.editView = Ext.create("DocumentEditor.view.document.PropertiesEdit");
            this.editView.hide();
    
    
    
    
            this.items = [this.propertiesView, this.editView];
    
    
    
    
            this.callParent(arguments);
        }
    });
    Code:
        onPanelRendered: function () {
            // Create the detail panel and add it to the workspace as a tab
            this.detailPanel = Ext.create('DocumentEditor.view.document.Details');
    
    
    
    
            var workspace = Ext.ComponentQuery.query('#workspace');
            if (workspace.length == 0)
                throw "No workspace found";
    
    
    
    
            workspace[0].add(this.detailPanel);
            this.detailPanel.propertiesView.show();
        }

  4. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    85
    Vote Rating
    1
    KallDrexx is on a distinguished road

      0  

    Default


    Yep that did it. Look like I need to be much more careful about scoping than I am in C#.

    Thanks!

Thread Participants: 1