1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    64
    Vote Rating
    3
    jkyoutsey is on a distinguished road

      0  

    Exclamation 4.2 Grouped Grid Example with initComponent error

    4.2 Grouped Grid Example with initComponent error


    I wanted to edit the example at:
    http://docs.sencha.com/ext-js/4-2/#!...ature.Grouping
    to show a possible bug in 4.2. But when I add an initComponent to it it fails with:
    TypeError: Cannot call method 'insert' of undefined
    I've had the same problem in various other stabs at replicating this problem outside of my app. So I can't repro a bug condition because I can't get anything outside of an MVC setup to run with an initComponent?!
    HELP!
    Here is what I edited the example to be: (all i did was add the initComponent)
    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId:'employeeStore',
        fields:['name', 'seniority', 'department'],
        groupField: 'department',
        data: {'employees':[
            { "name": "Michael Scott",  "seniority": 7, "department": "Management" },
            { "name": "Dwight Schrute", "seniority": 2, "department": "Sales" },
            { "name": "Jim Halpert",    "seniority": 3, "department": "Sales" },
            { "name": "Kevin Malone",   "seniority": 4, "department": "Accounting" },
            { "name": "Angela Martin",  "seniority": 5, "department": "Accounting" }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'employees'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Employees',
        store: Ext.data.StoreManager.lookup('employeeStore'),
        columns: [
            { text: 'Name',     dataIndex: 'name' },
            { text: 'Seniority', dataIndex: 'seniority' }
        ],
        features: [{ftype:'grouping'}],
        width: 200,
        height: 275,
        renderTo: Ext.getBody(),
        initComponent : function() {
            this.callParent(arguments);
        }
    });
    What I WANT to add is this: (I need access to "this" in the handler to collapse/expand all groups on a button click)
    Code:
        expandAllGroups: function () {
            Ext.getCmp('toggleGroupExpansionButton').setText('Collapse All');
            this.getView().getFeature('groupingFeature').expandAll();
        },
    
    
        collapseAllGroups: function () {
            var btn = Ext.getCmp('toggleGroupExpansionButton');
            if (btn) {
                btn.setText('Expand All');
            }
    
    
            this.getView().getFeature('groupingFeature').expandAll();
            this.getView().getFeature('groupingFeature').collapseAll();
        },
        
        initComponent : function() {
            var me = this;
            this.dockedItems = [{
                xtype: 'toolbar',
                dock: 'top',
                items: [{
                    xtype: 'button',
                    id: 'toggleGroupExpansionButton',
                    text: 'Expand All',
                    handler: function () {
                        var btn = Ext.getCmp('toggleGroupExpansionButton');
                        if (btn.text == 'Expand All') {
                            me.expandAllGroups();
                        } else {
                            me.collapseAllGroups();
                        }
                    }
                }]
            }];
            
            this.callParent(arguments);
        }
    Last edited by jkyoutsey; 3 Apr 2013 at 9:51 AM. Reason: Additional Info

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,795
    Vote Rating
    602
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    callParent won't work if you're inline overriding methods. Instead, you need to define a subclass.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    64
    Vote Rating
    3
    jkyoutsey is on a distinguished road

      0  

    Default


    Thank you! That was the bit I was missing!

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..." hd porno faketaxi