Eric
Eric

Reputation: 3243

List the fields associated with a record in ext.js

I have a bit of ext.js code that looks like:

items: [

    {
        xtype: 'textfield',
        hidden: false,
        fieldLabel: 'MyType',
        inputId: 'MyType',
        bind: {
            value: '{MyType}'
        }
    }                
]

On the page the text that's displayed is:

[object Object]

I can't figure out how to see what the properties of this object are.

In the console if I do a

document.getElementById('MyType').value.__proto__

I see:

String { "" }

Upvotes: 0

Views: 121

Answers (1)

mcg1103
mcg1103

Reputation: 688

If MyType is an instance of Ext.data.Model you can see what fields are in the model with console.log("MyType data: %o", MyType.data);

The bind functionality requires a get and set for the value. So if MyType had a config value of blaBla then the class system would automatically create a getter and setter for blaBla. you could then bind value to {MyType.blaBla}

if MyType is a model and it has a field named "xyzPdq" then you can bind to {MyType.xyzPdq}

Upvotes: 0

Related Questions