Re: Adding a new feild to Detail Section in Customer Care Tab
Posted: Fri Aug 10, 2012 11:14 am
Thought I would weigh in on this one. godson: if I'm understanding you correctly, you do not already have an extra column in the database for 'totalFees'. Instead, you have a method called "getTotalFees" that returns you some derived value, correct? So you will actually never be setting a 'totalFees' column explicitly. If this is the case, you do not have to explicitly create a new database field if you don't want (or need) to. If you do this and annotate that field like you have, the getter is actually never called because the admin actually works off of reflection directly on the fields itself and does not use the getters/setters.
You can have derived fields be displayed in the admin (in our terminology we refer to these as 'non-persistent fields') if you actually want to display the result of a getter or any other method. I believe you can actually do this by simply adding @AdminPresentationOverrides to your class.
So, in your case, you would add something like this to the top of your OrderImpl subclass:
You can have derived fields be displayed in the admin (in our terminology we refer to these as 'non-persistent fields') if you actually want to display the result of a getter or any other method. I believe you can actually do this by simply adding @AdminPresentationOverrides to your class.
So, in your case, you would add something like this to the top of your OrderImpl subclass:
Code: Select all
@AdminPresentationOverrides(@AdminPresentationOverride(name="getTotalFees", value=@AdminPresentation(friendlyName="Total Fees", fieldType=SupportedFieldType.MONEY))
public class PBOrderImpl extends OrderImpl implements PBOrder {
...
...