Quick search:


How to define options for a property

A property may have options. If so, they can be retrieved by calling the getOptions method on the peanut, with the name of the property as the argument. The options should be an array of valid values for the property. How the peanut produces the options ultimately is it's own business. It may have an options getter method that returns the value, or rely on the default property behavior supplied by the propertyDescriptor of the property. The default behavior is to call the '_getPeanuts' method on the classDescriptor of the properties type. For persistent objects this will result in retrieving all peanuts of the type from the database. For other peanuts the static method 'getInstances' must be defined or an error will occur.

An options getter method must be named "get" concatenated with the ucFirst of the property name followed by "Options" and should work with no arguments. If a property options getter method exists it will always be called whenever property options are retrieved.

EditDetailsPages will try to retrieve property options for all properties that should be edited and whose type is not a primitive datatype. Defining a property options getter method will cause the EditDetailsPage default behavior to always use a select list with all the property options, there will be no dialog.