Extjs TextField.getFieldLabel()不工作

Extjs TextField.getFieldLabel()不工作,extjs,extjs4,sencha-touch-2,extjs4.2,extjs-grid,Extjs,Extjs4,Sencha Touch 2,Extjs4.2,Extjs Grid,但是ExtJS4.2文档却不这么说。。。? 无论我用什么方法来达到“标签”。我总是收到一个没有getFieldLabel()的对象。我如何转换?还是直接到达 有人能帮忙吗 行模型的代码: Uncaught TypeError: Object [object Object] has no method 'getFieldLabel' 您可以通过itemId找到textfield: Ext.define('Prototype.view.RowModel', { extend: 'Ext.Cont

但是ExtJS4.2文档却不这么说。。。? 无论我用什么方法来达到“标签”。我总是收到一个没有getFieldLabel()的对象。我如何转换?还是直接到达

有人能帮忙吗

行模型的代码:

Uncaught TypeError: Object [object Object] has no method 'getFieldLabel' 

您可以通过itemId找到textfield:

Ext.define('Prototype.view.RowModel', {
extend: 'Ext.Container',

config: {
    layout: {
        type: 'hbox'
    },
    items: [
        {
            xtype: 'textfield',
            itemId: 'rowLabel',
            width: 100,
            label: 'Vin',
            labelWidth: '100%',
            name: 'rowLabel1',
            readOnly: true
        },
        {
            xtype: 'numberfield',
            itemId: 'UserField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'numberfield',
            itemId: 'ObjectField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'textfield',
            itemId: 'UnitLabel',
            style: 'font-size:15px',
            width: 60,
            label: 'L/User',
            labelWidth: '100%',
            readOnly: true
        },
        {
            xtype: 'numberfield',
            itemId: 'FactorField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'spacer',
            maxWidth: 15
        },
        {
            xtype: 'button',
            handler: function(button, event) {
                alert('help');
                console.log('okay');
            },
            height: 47,
            itemId: 'mybutton',
            ui: 'plain',
            iconCls: 'info'
        }
    ]
}

});

您可以通过itemId找到textfield:

Ext.define('Prototype.view.RowModel', {
extend: 'Ext.Container',

config: {
    layout: {
        type: 'hbox'
    },
    items: [
        {
            xtype: 'textfield',
            itemId: 'rowLabel',
            width: 100,
            label: 'Vin',
            labelWidth: '100%',
            name: 'rowLabel1',
            readOnly: true
        },
        {
            xtype: 'numberfield',
            itemId: 'UserField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'numberfield',
            itemId: 'ObjectField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'textfield',
            itemId: 'UnitLabel',
            style: 'font-size:15px',
            width: 60,
            label: 'L/User',
            labelWidth: '100%',
            readOnly: true
        },
        {
            xtype: 'numberfield',
            itemId: 'FactorField',
            width: 100,
            labelWidth: '0%'
        },
        {
            xtype: 'spacer',
            maxWidth: 15
        },
        {
            xtype: 'button',
            handler: function(button, event) {
                alert('help');
                console.log('okay');
            },
            height: 47,
            itemId: 'mybutton',
            ui: 'plain',
            iconCls: 'info'
        }
    ]
}

});

您是否检查了row.getComponent(0).getXType()是否返回“textfield”?告诉我相同的错误:未捕获类型错误:对象[Object Object]没有方法“getXType”,我得到的是一个对象而不是文本字段。但是如果我尝试使用.getId()。它给了我textfield的id,因此getComponent(0)是一个textfield,但我似乎可以在这种类型的对象中访问它。我不明白网格中您所在行的textfield在做什么?那是编辑吗?请共享更多代码。我的行是一个HBOX容器,包含2个文本字段、3个数字字段和1个按钮。是否检查了row.getComponent(0)。getXType()是否返回“textfield”?请告诉我相同的错误:未捕获的类型错误:Object[Object Object Object]没有方法“getXType”,我得到的是一个对象而不是文本字段。但是如果我尝试使用.getId()。它给了我textfield的id,因此getComponent(0)是一个textfield,但我似乎可以在这种类型的对象中访问它。我不明白网格中您所在行的textfield在做什么?那是编辑吗?请分享更多代码。我的行是一个HBOX容器,包含2个文本字段、3个数字字段和1个按钮。我写了:row.down(“#rowLabel”)。_label它工作了,但我不应该使用公共方法(getters)来获取标签吗。getFieldLabel()不起作用:我写了:row.down(“#rowLabel”)。label它起作用了,但我不应该使用公共方法(getters)来获取标签吗。getFieldLabel()不起作用:S
row.down('#rowLabel');