Как вызвать некоторую функцию плагина из кнопки. Вызов «Ext.grid.plugin.Editable» из кнопки - PullRequest
0 голосов
/ 05 апреля 2019

Я определить в панели сетку.И подключил «Ext.grid.plugin.Editable» к этой сетке.Далее, я хочу, чтобы кнопка на панели (второй элемент после сетки) вызывала меню «Ext.grid.plugin.Editable» (для добавления новой строки в сетку, заполнив форму. Как я могу это сделать? Чтобы вызвать редактируемое меню с помощьюнажмите на кнопку на панели?

{
        xtype:'panel',
        tab: {cls: 'hdr3'},
        title:'forst',
        scope:this,
        layout:'vbox',
        id:'cut-area-grid-in-tab',
        items: [{
        xtype:'button',
        centured:true,
        margin: '20 0 0 0',
        padding: 5,
        width: '100%',
        cls: 'buttonsforsave',
        text:'+add',
        handler: function() {
                //FUNCTION FOR Ext.grid.plugin.Editable MENU CALLING

                }
            },{
            xtype:'cut-area-grid',// THIS IS GRID
             }

UPD Как вы подключаете плагин? - плагин ответа включается в класс сетки таким образом.

    plugins: [{
        type: 'grideditable',
        triggerEvent: 'doubletap',
        enableDeleteButton: true,
        formConfig: null, // See more below

        defaultFormConfig: {
            xtype: 'formpanel',
            title:'edit',
            scrollable: true,
            items: {
                xtype: 'fieldset'
            }
        },

        toolbarConfig: {
            xtype: 'titlebar',
//            cls : 'hdr2',
//            height: 46.63,
            docked: 'bottom',
            items: [{
                xtype: 'button',
//                ui: 'decline',
//                cls: 'grbuttons',
                text: 'no',
                align: 'left',
                action: 'cancel'
            }, {
                xtype: 'button',
//                ui: 'confirm',
//                cls: 'grbuttons',
                text: 'save',
                align: 'right',
                action: 'submit',
                handler: function () {
                    var rentgrid = this.up('#rentlist');
                    rentgrid.getStore().getModifiedRecords();
                }
            },{
                 xtype: 'button',
                 text: 'Delete',
                 ui: 'decline',
                 margin: 10,
                 handler: function() {
                    Ext.Ajax.request({          
                        url:'/api/agreement/',
                        reader:{
                            type:'json',
                            rootProperty: 'results'
                        },
                        method: 'DELETE'
                    });
                 }
            }]
        }

    },
...