-1

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();
Foulen
  • 25
  • 2

1 Answers1

0

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.

Trevor Karjanis
  • 1,485
  • 14
  • 25
  • I tried to define feature adn giving a type : - var feature = Ext.create('Ext.grid.feature.GroupingSummary', { startCollapsed: true, ftype: 'grouping' }); But i found the same error, i can't identify the problem. – Foulen Feb 21 '18 at 08:32
  • What I mean is to ensure that the feature class is loaded before it is used by declaring a dependency on it. This is done using the requires configuration. I've updated my answer. – Trevor Karjanis Feb 21 '18 at 15:28
  • yes, i used require configuration for Ext.grid.* and Ext.grid.feature.GroupingSummary but it's still the same problem. :( – Foulen Feb 21 '18 at 15:44
  • It looks like it is missing a class. However, I am not sure which. – Trevor Karjanis Feb 23 '18 at 18:46