如何从按钮调用一些插件功能。通过按钮

时间:2019-04-05 10:00:57

标签: javascript extjs grid extjs6-modern

我在面板中定义一个网格。并将“ 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 如何包含插件? -回答 插件包括在这样的网格类中。 加上olugin在grid类的require中定义。

    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'
                    });
                 }
            }]
        }

    },

0 个答案:

没有答案