List the fields associated with a record in ext.js

90 views Asked by At

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 { "" }
1

There are 1 answers

0
mcg1103 On

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}