Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript extjs网格行编辑删除_Javascript_Extjs - Fatal编程技术网

Javascript extjs网格行编辑删除

Javascript extjs网格行编辑删除,javascript,extjs,Javascript,Extjs,在我的网格中,我已经激活了对配置中的行的编辑。但是现在我想删除这个选项,因为只有某些用户应该编辑这个表 如何禁用或删除插件 Ext.define('mdb.view.Mapping', { extend: 'Ext.grid.Panel', xtype: 'array-grid', requires: [ 'Ext.grid.column.Action' ], plugins: { gridfilters: true, rowediting: { clic

在我的网格中,我已经激活了对配置中的行的编辑。但是现在我想删除这个选项,因为只有某些用户应该编辑这个表

如何禁用或删除插件

Ext.define('mdb.view.Mapping', {
extend: 'Ext.grid.Panel',
xtype: 'array-grid',
requires: [
    'Ext.grid.column.Action'
],
plugins: {
    gridfilters: true,
    rowediting: {
        clicksToMoveEditor: 1,
        autoCancel: false,
        //autoUpdate: false,
        saveBtnText : "Speichern",
        cancelBtnText: 'Abbrechen',
        listeners: {
            edit: 'editItem'
        }
    }
},
我尝试的是这样的

Ext.getCmp('mappingGrid').editingPlugin.editor.disable

rowediting插件上的beforeedit事件。返回false不允许编辑返回true允许编辑

这里有一个提琴

试试grid.getPlugin('rowediting')。enable()或.disable()

Ext.application({
    name: 'Fiddle',

    launch: function () {
        Ext.create('Ext.data.Store', {
            storeId: 'simpsonsStore',
            fields: ['name', 'email', 'phone'],
            data: [{
                name: 'Lisa',
                email: 'lisa@simpsons.com',
                phone: '555-111-1224'
            }, {
                name: 'Bart',
                email: 'bart@simpsons.com',
                phone: '555-222-1234'
            }, {
                name: 'Homer',
                email: 'homer@simpsons.com',
                phone: '555-222-1244'
            }, {
                name: 'Marge',
                email: 'marge@simpsons.com',
                phone: '555-222-1254'
            }]
        });

        Ext.create('Ext.grid.Panel', {
            title: 'Grid Row Editing',
            store: "simpsonsStore",
            renderTo: Ext.getBody(),
            height: 300,
            plugins: {
                rowediting: {
                    clicksToMoveEditor: 1,
                    autoCancel: false
                }
            },
            dockedItems: [{
                xtype: 'toolbar',
                items: [{
                    text: "Disabled Row Editing",
                    toggledText: "Enable Row Editing",
                    enableToggle: true,
                    toggleHandler: function (button, state) {
                        let rowEditingPlugin = this.up('grid').getPlugin('rowediting');
                        rowEditingPlugin.cancelEdit();
                        [
                            button.text,
                            button.toggledText
                        ] = [
                            button.toggledText,
                            button.text
                        ];
                        button.updateText(button.text);
                        if (state) {
                            rowEditingPlugin.disable();
                        } else {
                            rowEditingPlugin.enable();
                        }
                    }
                }]
            }],
            columns: [{
                text: 'Name',
                dataIndex: 'name',
                editor: {
                    xtype: 'textfield',
                    allowBlank: false
                }
            }, {
                text: 'Email',
                dataIndex: 'email',
                flex: 1,
                editor: {
                    xtype: 'textfield',
                    allowBlank: false
                }
            }, {
                text: 'Phone',
                dataIndex: 'phone',
                editor: {
                    xtype: 'textfield',
                    allowBlank: false
                }
            }]
        });
    }
});