ExtJS 4> Line Editor Grid> How to Change the Refresh Button Text

Is there a way to change the text of the Refresh button in the grid of the ExtJS-4 line editor?

+5
source share
4 answers

Good question, I looked at the source code, and while there is nothing inside the RowEditing plugin, it extends "RowEditor.js" in the class, there is the following:

Ext.define('Ext.grid.RowEditor', {
    extend: 'Ext.form.Panel',
    requires: [
        'Ext.tip.ToolTip',
        'Ext.util.HashMap',
        'Ext.util.KeyNav'
    ],

    saveBtnText  : 'Update',
    cancelBtnText: 'Cancel',
    ...
});

So, I would suggest that you just need to override 'saveBtnText'in your instance 'Ext.grid.plugin.RowEditing', since it calls the parent constructor using the callParent (arguments) method in the classRowEditing

+4
source

. , Ext.grid.plugin.RowEditing Ext.grid.RowEditor, . initEditor() :

// ...
plugins: [{
    ptype: 'rowediting',
    clicksToEdit: 2,
    initEditor: function() {
        var me = this,
            grid = me.grid,
            view = me.view,
            headerCt = grid.headerCt;

        return Ext.create('Ext.grid.RowEditor', {
            autoCancel: me.autoCancel,
            errorSummary: me.errorSummary,
            fields: headerCt.getGridColumns(),
            hidden: true,

            // keep a reference..
            editingPlugin: me,
            renderTo: view.el,
            saveBtnText: 'This is my save button text', // <<---
            cancelBtnText: 'This is my cancel button text' // <<---
        });
    },
}],
// ...
+4

ExtJS 4

Ext.grid.RowEditor.prototype.cancelBtnText = "This is cancel";
Ext.grid.RowEditor.prototype.saveBtnText = "This is update";
+3

- rowEditors. , . , .

:

initEditorConfig: function(){
        var me       = this,
            grid     = me.grid,
            view     = me.view,
            headerCt = grid.headerCt,
            btns     = ['saveBtnText', 'cancelBtnText', 'errorsText', 'dirtyText'],
            b,
            bLen     = btns.length,
            cfg      = {
                autoCancel: me.autoCancel,
                errorSummary: me.errorSummary,
                fields: headerCt.getGridColumns(),
                hidden: true,
                view: view,
                // keep a reference..
                editingPlugin: me
            },
            item;
    for (b = 0; b < bLen; b++) {
        item = btns[b];

        if (Ext.isDefined(me[item])) {
            cfg[item] = me[item];
        }
    }
    return cfg;
}`

rowEditor, btns Array:

btns :

btns = ['saveBtnText', 'cancelBtnText', 'errorsText', 'dirtyText']    

for (b = 0; b < bLen; b++) {
        item = btns[b];

        if (Ext.isDefined(me[item])) {
            cfg[item] = me[item];
        }
    }

foreach string btnArray , cfg , config. , , :

: :

the saveBtnText property, which is the first element of the btns array, must exist in cfg:

if (Ext.isDefined(me[item])) {
 cfg[item] = me[item];
}

this search if the property exists: if (Ext.isDefined(me[item]))

if saveBtnText already exists in rowEditor properties, then:

cfg[item] = me[item];

and an additional config property will be added !!

0
source

All Articles