Button 更改按钮文本(选择字段)-触摸Sencha

Button 更改按钮文本(选择字段)-触摸Sencha,button,localization,sencha-touch,Button,Localization,Sencha Touch,如何将selectfield中的按钮文本(“完成”和“取消”)更改为德语或任何我喜欢的文本 xtype: 'selectfield', name: 'sector', width: 150, prependText: 'Sector:', options: [ {text: 'Alle Termine', value: 'alldates'}, ] 一种简单的可能性是覆盖选择器的默认值,例如: Ext.ove

如何将selectfield中的按钮文本(“完成”和“取消”)更改为德语或任何我喜欢的文本

xtype: 'selectfield',
    name: 'sector',
    width: 150,
    prependText: 'Sector:',
    options: [
              {text: 'Alle Termine', value: 'alldates'},
             ]

一种简单的可能性是覆盖选择器的默认值,例如:

Ext.override(Ext.Picker, {
  doneButton: 'Fertig',
  cancelButton: 'Abbrechen'
});

您可以扩展Ext.form.Select以允许您将自己的配置应用于它使用的选择器

Ext.ns('MySite.ux.form');
MySite.ux.form.Select = Ext.extend(Ext.form.Select , {
    getPicker: function() {
        if (!this.picker) {
            this.picker = new Ext.Picker(Ext.apply({
                slots: [{
                    align       : 'center',
                    name        : this.name,
                    valueField  : this.valueField,
                    displayField: this.displayField,
                    value       : this.getValue(),
                    store       : this.store
                }],
                listeners: {
                    change: this.onPickerChange,
                    scope: this
                }
            }, this.pickerConfig));
        }
        return this.picker;
    }
});
Ext.reg('myselectfield', MySite.ux.form.Select);
您的selectfield配置可能如下所示:

{
    xtype: 'myselectfield',
    name: 'sector',
    label: 'Sector',
    pickerConfig: {
        doneButton: 'Fertig',
        cancelButton: 'Abbrechen'
    }
}