如何更改errorSummary的默认标题来自"错误"在EXTJ中的其他东西

时间:2017-03-06 08:42:48

标签: extjs

如何在Extjs中自定义errorSummary? errorSummary的默认标题是"错误"(附带截图供参考),有没有办法将其更改为其他内容?

Image

 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":"home@simpsons.com", "phone":"555-222-1244"},
     {"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
 ] 
});

Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
    {header: 'Name',  dataIndex: 'name', editor: 'textfield'},
    {header: 'Email', dataIndex: 'email', flex:1,
        editor: {
            xtype: 'textfield',
            allowBlank: false
        }
    },
    {header: 'Phone', dataIndex: 'phone'}
],
selType: 'rowmodel',
plugins: [
    Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToEdit: 1,
        errorSummary:true,
    })
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});

2 个答案:

答案 0 :(得分:3)

plugins: [
    Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToEdit: 1,
        errorsText:'test',
        errorSummary:true
    })
],

答案 1 :(得分:1)

如果您想全局更改,我们可以使用以下代码覆盖编辑插件。

     Ext.define('OverridedRowEditing',{
       override: 'Ext.grid.plugin.RowEditing',
       config: {
           errorsText: 'Test'
       }
    });