3

我想在 DisplayField 中将“Labelxx”更改为“新标签”。我怎样才能做到这一点?下面是我的代码:

MyFormUi = Ext.extend(Ext.form.FormPanel, {
    title: 'Rates ',
    id: 'id_form',
    initComponent: function() {
        this.items = [{
            xtype: 'displayfield',
            fieldLabel: 'Labelxx',
            anchor: '100%',
            name: 'name_lb',
            ref: 'localCurrencylbl',
            id: 'id_lb'
        }];
        MyFormUi.superclass.initComponent.call(this);
    }
});
4

3 回答 3

5

要更改 DisplayField text

Ext.getCmp('id_lb').setValue('New text');

要更改fieldLabel

Ext.getCmp('id_lb').setFieldLabel('New Label');

注意:不建议使用 id's tho。

于 2013-02-06T09:03:24.490 回答
2

在 ExtJs 3.X 中更改 fieldLabel:

Ext.getCmp('id_lb').label.update("Dynamically changed text");
于 2015-08-04T19:10:10.607 回答
0

setValue 将改变显示字段的值。它不会改变 fieldLabel。

于 2013-02-06T18:20:27.620 回答