有没有办法在ExtJS-4行编辑器网格中改变“更新”按钮的文本?
发布于 2011-10-13 16:23:36
问得好,我看了一下源代码,虽然RowEditing插件中没有任何东西,但在它扩展的'RowEditor.js‘类中有以下内容:
Ext.define('Ext.grid.RowEditor', {
extend: 'Ext.form.Panel',
requires: [
'Ext.tip.ToolTip',
'Ext.util.HashMap',
'Ext.util.KeyNav'
],
saveBtnText : 'Update',
cancelBtnText: 'Cancel',
...
});因此,我假设您只需要覆盖'Ext.grid.plugin.RowEditing'实例中的'saveBtnText',因为它在RowEditing类中使用callParent(参数)调用父构造函数
发布于 2011-10-13 16:24:23
这并不容易,而且不能不在未记录的区域进行黑客攻击。问题是,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' // <<---
});
},
}],
// ...发布于 2013-07-07 03:15:01
对于ExtJS 4
Ext.grid.RowEditor.prototype.cancelBtnText = "This is cancel";
Ext.grid.RowEditor.prototype.saveBtnText = "This is update";https://stackoverflow.com/questions/7750529
复制相似问题