使用通用方法覆盖每个组合getValue字段

Override every Combo getValue Field using common method?

本文关键字:组合 getValue 字段 覆盖 方法      更新时间:2023-09-26

我在extjs应用程序中有combo,comob box ID(valueField)HTML编码(因为它们有特殊的字符)

如何覆盖每个组合getValue方法返回的解码HTML值

注意:我覆盖文本字段setValue使用波纹管法

Ext.override(Ext.form.field.Base, {
    transformRawValue: function(val) {
        val = Ext.util.Format.htmlDecode(val);
        return this.callParent([val]);
    }  
});

在4.x+中,重写有不同的语法。

Ext.define("App.overrides.form.ComboBox",{
    override: 'Ext.form.ComboBox',
    getValue: function () {
        return Ext.util.Format.htmlDecode(this.value);
    }
});