Grid : features groupingsummary doesn't work extjs 6.5.0

527 Views Asked by At

enter image description hereI am new with Extjs 6, and i am implementing a Grid with groupping summary features, i tried this two examples : http://examples.sencha.com/extjs/6.5.0/examples/classic/grid/group-summary-grid.html but doesn't work, i have this problem in my browzer console. Have someone an idea about this errors? enter image description here

    Ext.define('TestResult', {
        extend: 'Ext.data.Model',
        fields: ['student', 'subject', {
            name: 'mark',
            type: 'int'
        }]
    });

    var grid = Ext.create('Ext.grid.Panel', {
        width: 200,
        height: 240,
        features: [{
            groupHeaderTpl: 'Subject: {name}',
            ftype: 'groupingsummary'
        }],
        store: {
            model: 'TestResult',
            groupField: 'subject',
            data: [{
                student: 'Student 1',
                subject: 'Math',
                mark: 84
            }, {
                student: 'Student 1',
                subject: 'Science',
                mark: 72
            }, {
                student: 'Student 2',
                subject: 'Math',
                mark: 96
            }, {
                student: 'Student 2',
                subject: 'Science',
                mark: 68
            }]
        },
        columns: [{
            dataIndex: 'student',
            text: 'Name',
            summaryType: 'count',
            summaryRenderer: function (value) {
                return Ext.String.format('{0} student{1}', value, value !== 1 ? 's' : '');
            }
        }, {
            dataIndex: 'mark',
            text: 'Mark',
            summaryType: 'average'
        }]
    });
    var win = Ext.create('Ext.window.Window', {
        width: 300,
        height: 200,
        items: [grid]
    });
    win.show();

1

There are 1 best solutions below

4
On

Ext.view.Table.constructFeatures calls Ext.create which in turn calls the following.

feature = Ext.create('feature.' + feature.ftype, feature);

It doesn't look like the feature configuration has any typos, so Ext.create will eventually call the class manager passing the resolved class for the feature.

cls = Manager.get(name);
...
return Manager.getInstantiator(args.length)(cls, args);

From the exception, "c" is "cls" - the feature class. Therefore, I think the class manager is not finding the feature class. Make sure you've added Ext.grid.feature.GroupingSummary to the requires declaration so that the class is loaded and available.