ExtJS 6.2无法将插件添加到内部网格-TypeError:视图未定义

Coderino Javarino

我有一个带有拖放和行编辑插件的网格。当它是外部类时,它的工作被罚款。但是,由于我从一个类中剥离了网格并将其作为内部组件放置,它开始给我带来错误。如果我注释掉有关插件的代码,则可以正常工作。

Ext.define('Dashboards.view.widgets.barChartAndLine.BarChartAndLineWidgetForm', {

    extend: 'Dashboards.view.widgets.WidgetBaseForm',

    xtype: 'barChartAndLineWidgetForm',



    items : [{
            xtype: 'grid',
            rowEditing: null,
            viewConfig: {
                plugins: {
                    ptype: 'gridviewdragdrop'
                }
            },
        listeners: {
            drop: function() {
                this.updateData();
            }
        },

        initComponent: function() {
            var me = this;
            this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
                clicksToMoveEditor: 1,
                autoCancel: false,
                listeners: {
                    edit: function() {
                        me.updateData();
                    }
                }
            });
            this.plugins = [this.rowEditing];
            this.callParent(arguments);
        },

        store: {
            fields : ['label', 'linevalue', 'barvalue'],
            bind : {
                data : '{widget.data.data.items}'
            }
        },

        columns: [{
            header: 'Pavadinimas',
            dataIndex: 'label',
            flex: 3,
            editor: {
                allowBlank: false
            }
        }, {
            xtype: 'numbercolumn',
            header: 'Stulpelio reikšmė',
            dataIndex: 'barvalue',
            flex: 1,
            editor: {
                xtype: 'numberfield',
                allowBlank: false
            }
        }, {
            xtype: 'numbercolumn',
            header: 'Linijos reikšmė',
            dataIndex: 'linevalue',
            flex: 1,
            editor: {
                xtype: 'numberfield',
                allowBlank: false
            }
        }, {
            xtype: 'actioncolumn',
            width: 30,
            items: [{
                iconCls: 'x-fa fa-trash',
                tooltip: 'Pašalinti',
                handler: function(g, ri, ci) {
                    var grid = this.up().up();
                    grid.getStore().removeAt(ri);
                    grid.getStore().sync();
                }
            }]
        }],

        tbar: [{
            xtype: 'button',
            text: 'Pridėti',
            handler: function() {
                var grid = this.up().up();
                var r = {
                    label: 'label',
                    linevalue: '0',
                    barvalue: '0'
                };
                var modelResult = grid.getStore().insert(0, r);
            }
        }]

    }]
});
Yilei Mou

可以在grid的配置中设置插件,而不是在initComponent函数中添加rowediting插件。

基于您的代码具有远程数据,我创建了一个小提琴来测试视图,您可以将视图结构与您的数据一起应用。

如果您有任何疑问,请告诉我。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

EXTJS 6 Modern:缓冲存储+网格:未捕获的TypeError:无法读取未定义的属性'length'

Angular 6:TypeError:无法读取未定义的属性“值”

Angular 6 TypeError:无法读取未定义的属性“ call”

角6:TypeError:无法读取未定义的属性“无效”?

extjs 6网格自定义标头

ExtJS 6-将文本字段控件添加到动态网格列标题中

无法将网格添加到extjs中的div

Login.js:6未捕获的TypeError:无法读取未定义的属性“ then”

ReactJS ES6函数绑定-未捕获的TypeError:无法读取未定义的属性“更新”

角度6:错误TypeError:无法读取未定义的属性“ toLowerCase”

es6模块导出/导入:未捕获的TypeError:无法读取未定义的属性“默认”

错误TypeError:无法读取未定义的属性“值”:角度6

Angular6-FormControlName-TypeError:无法读取未定义的属性“ get”

从ES6类方法获取错误“ TypeError:无法读取未定义的属性'doFileHasCorrectFileExtension'

Angular 6+ TypeError:无法读取未定义的属性“firstName”

在 React 中使用 JS ES6 承诺的问题 - TypeError:无法读取未定义的属性“then”

Angular 6-错误TypeError:无法读取未定义的属性“值”

Angular 6-错误TypeError:显示输出时,无法读取未定义的属性“ firstName”

Angular 6 TypeError:无法读取未定义的属性“ e4b7 ... f”

Angular6-TypeError:无法读取未定义的属性“模板”

Angular 6:TypeError:无法获取未定义或空引用的属性“ nativeElement”

TypeError:无法读取ES6模型上未定义的属性“ first_name”

TypeError:无法设置未定义的属性“ frozenRowCount”(第6行,“ Header-Row-Frozen”文件)

无法将项目添加到extjs中的自定义组件

ExtJS。无法使用ExtJS 6 GPL日历应用程序

ExtJS 6将git.workspace.json添加到gitignore

绑定网格和表单 ExtJs 6

网格之间的Extjs6关联

网格单元中的工具提示-ExtJs 6