I have a displayfield as follows
{
fieldLabel: 'Designation', name: 'designation', xtype: 'displayfield',
listeners: {
beforerender:
{
fn: function (v) {
// get value here
},
scope: this
}
}
}
I tried to get value of displayfield using
v.getValue(), v.el.getValue(), v.getEl().getValue()
But everytime it shows undefined.
I also tried changing beforerender listener to render. But still the value id undefined.
Can anybody help me out of it.
So, as I understand it - you're relying on the form to populate the displayfield.
Given that's the case, the value is populated after rendering - so it won't be available during the rendering process.
You can prove that by creating a
setValuemethod of your own, and putting a breakpoint in. This will let you see when the value is populated, relative to the rendering process.Without more details on how you get the JSON object and when it's used to populate the form, I can't help you much more.