Sencha2 - 如何从Panel获取数据到子字段集组件?

时间:2012-05-17 17:40:30

标签: extjs sencha-touch-2

如何从Panel获取子项目数据?我有Panel的记录属性中的数据,但我想到它来设置字段集内的文本字段的值。

Ext.define('My.view.MyDetail', {
extend: 'Ext.Panel',
xtype: 'mydetail',
requires: [        
],

config: {
    refs: {
    },

    title: 'Details',
    styleHtmlContent: true,
    scrollable: 'vertical',

{
    xtype: 'fieldset',
    title: 'About You',
    instructions: 'Tell us all about yourself',
    items: [
        {
            xtype: 'textfield',
            name : 'firstName',
            label: 'First Name',
                            data?, record? how do I get something from this Panel's record?
        },
...
The data is here in this.getData().firstName
    listeners: {
    show: function(list, opts){
        console.log(this.getData().firstName);
    }
}   
});

1 个答案:

答案 0 :(得分:3)

在文字字段中添加ID 使用:Ext.getCmp('yourID').getValue() //获取值 Ext.getCmp('yourID').setValue(this.getData().firstName) //设置值