Wednesday, January 15, 2014

Accessing Custom Attribute Property from ADF UI Expression

You may not know, but it is possible to access custom property defined for the VO/EO attribute from ADF UI expression. This may turn useful, when implementing custom generic functionality and standard attributes are not enough. In this example, I'm using custom property - alternativeName, in real use case this will be something else. Here I will pass alternative name for the attribute through this property:


Custom property defined for the attribute, can be accessed from ADF UI Expression, by referencing properties map - bindings.AttributeName.attributeDef.properties.PropertyName:


This is how property is accessed, later it can be displayed on UI - see label text for the CommissionPct attribute:


You can download sample application here - CustomPropertyApp.zip.

2 comments:

Vanessa said...

Hi Andrejus.
Very useful your post, thank you!
I have created a custom property for an attribute at EO level and I have problems to access it within af:table column.
af:table uses row.CountryName instead of bindings.CountryName and I don't know how to access it...I try row.bindings.CountryName.attributeDef.properties.PropertyName but nothing.

Is there a way to access it within af:table or it's impossible?

Thank you very much.

Andrejus Baranovskis said...

Hi,

I guess in this way you are accessing custom property from VO attribute. Try to define custom property in VO attribute, not in EO.

Regards,
Andrejus