Conditionals in WOBuilder
WOConditional is a very flexible dynamic element.
You can bind boolean and Boolean, but did you know you can use it to
conditionally hide content for optional attributes or related EOs?
...
Bind any object to a WOConditional and if the
object is null, the conditional evaluates to false, hiding the content. This
works great for objects, attributes and to-one
relationships.For to-many
relationships, EOF returns an empty NSArray, so you can bind
object.relatedObjects.@count which will evaluate to zero of there are no objects
in the to-many relationship. WOConditional treats zero as false, hiding the
content.You can create your own
'custom' conditionals by simply using one or more WOConditionals wrapping
WOComponentContent inside a reusable component with custom binding API. Project
Wonder has a bunch of custom conditionals that you can use as examples for
creating your own. Open the ERXExtensions project in XCode and see the
Sources/WOF/Conditionals
group.
Posted: Wednesday - July 06, 2005 at 02:48 PM