Todd Murray
Todd Murray

Reputation: 423

Sencha2 - How do I get data from Panel to child fieldset components?

How do I get data from a Panel to child items? I have the data in the Panel's record property but I want to get to it to set the value of a textfield inside a fieldset.

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);
    }
}   
});

Upvotes: 3

Views: 2092

Answers (1)

john
john

Reputation: 1282

add an id to your textfield use: Ext.getCmp('yourID').getValue() // to get the value Ext.getCmp('yourID').setValue(this.getData().firstName) // to set a value

Upvotes: 3

Related Questions