Results 1 to 2 of 2

Thread: gridpanel reconfigure fails when 'grouping' feature used on store w/ autoDestroy true

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    51

    Default gridpanel reconfigure fails when 'grouping' feature used on store w/ autoDestroy true

    Steps to reproduce (code snippet at end):
    • Create a gridpanel that uses "grouping" feature.
    • Attach a store that has autoDestroy===true.
    • Reconfigure the grid with a new store instance (can be identical to old, as long as it's a different instance).

    Exceptions generated
    First exception occurs within Ext.data.Store.isGrouped() during grid refresh on the following line:
    Code:
        return this.groupers.getCount() > 0;
    The problem is that groupers is null at this point. The exception is caught within XTemplateCompiler.applyOut but isn't handled in any way: i.e., the template application is simply aborted. Consequently, a second, unhandled exception occurs within Ext.view.Table.collectNodes on the line...
    Code:
        this.all.fill(this.getNodeContainer().childNodes, this.all.startIndex);
    ...because the call to getNodeContainer() returns null (because the earlier exception prevented the view from being re-generated properly).

    Here's a simple app to reproduce... You should get the errors the first time you reconfigure the store by hitting the "Reconfigure..." button.
    Code:
    Ext.application({
        requires: ['Ext.container.Viewport'],
        name: 'GridPanel Test',
        appFolder: 'app',
        statics: {
            storeCnt: 0
        },
        launch: function() {
            var me = this,
                win = Ext.create('Ext.window.Window', {
                title: 'My Grid Window',
                layout: 'fit',
                floating: true,
                closable: true,
                constrainHeader: true,
                width: 800,
                height: 400,
                items: [{
                    xtype: 'gridpanel',
                    title: 'Simpsons',
                    store: this.createStore(),
                    features: [{
                        ftype: 'grouping'
                    }],
                    columns: [
                    { text: 'Name',  dataIndex: 'name' },
                    { text: 'Email', dataIndex: 'email', flex: 1 },
                    { text: 'Phone', dataIndex: 'phone' },
                    { text: 'Store Counter', dataIndex: 'storeCnt' }
                    ],
                    height: 200,
                    width: 400
                }],
                fbar: [
                    {
                        text: 'Reconfigure store...',
                        handler: function() {
                            // Create a new store instance and reconfigure the grid with it.
                            // Note: The store's autoDestroy config ensures destruction of the old store
                            win.down('gridpanel').reconfigure(me.createStore());
                        }
                    }
                ]
            }).show();
    
        },
        createStore: function() {
            var storeCnt = ++this.statics().storeCnt;
            // Create a new store instance (albeit with same data...)
            return Ext.create('Ext.data.Store', {
                autoDestroy: true,
                storeId:'simpsonsStore',
                fields:['name', 'email', 'phone', 'storeCnt'],
                data:{'items':[
                { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224", storeCnt: storeCnt },
                { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234", storeCnt: storeCnt },
                { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244", storeCnt: storeCnt },
                { 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254", storeCnt: storeCnt }
                ]},
                proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'items'
                }
                }
            });
        }
    });

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Posting Permissions

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