1
votes

In my project, I created widget alias for the below code in "View" as notifications. Now, how to access each and every item in "Controller" ?

extend: 'Ext.panel.Panel',
alias: 'widget.notifications',
layout: 'fit',
items:[{
    xtype: 'container',
    layout: {type: 'vbox', align: 'stretch'},
    items: {
        xtype: 'container',
        flex:1,
        layout: {type: 'vbox', align: 'stretch'},
        items:[{
            xtype: 'container',
            flex: 1,
            items: [{
                xtype: 'container',
                height: 20,                 
                html: "This week",                  
            },
            {
                xtype: 'container',
                flex: 1,
                layout: {type: 'vbox', align: 'stretch'},
                items: [{
                    xtype: 'container',
                    height:20,
                    html : 'show submit status here'
                },
                {
                    xtype: 'container',
                    flex: 1,
                }]
            }]
        },
        {
            xtype: 'container',
            flex: 1,
            layout: {type: 'vbox', align: 'stretch'},
            items: [{
                xtype: 'container',
                height: 20,
                html: "This month"
            },
            {
                xtype: 'container',
                flex: 1,
                layout: {type: 'vbox', align: 'stretch'},
                items: [{
                    xtype: 'container',
                    html: 'submit status of month here',
                    height: 20
                },
                {
                    xtype: 'container',
                    flex: 1,
                }]
            }]
        }]
    }
}]

I tried:

 var notificationView = Ext.widget('NotificationView');
 var childItem = notificationView.items.items[0].items.items[0].items.items[0].items.items[0];

Which just gives me headache and many errors.

I also tried using ComponentQuery like this:

var childItem = notificationView.ComponentQuery.query('container>container>container>container');

Which gets only the first child, not the other child items.

1

1 Answers

2
votes

You can use any arbitrary property of you component to identify it by in the component query. For example if you add property refId : 'myMonthlyStatus' to your last container, you can then find it using query('container [refId=myMonthlyStatus]') from anywhere.