Jump to content

WebObjects/Web Applications/Development/Examples/List Components

From Wikibooks, open books for an open world

So you have a title and a "list" of objects. The list has a minimum and maximum number of objects to display. If there is "too many" objects there is a "more..." link.

Here is the html:

  <webobject name="HasData">
    <webobject name="Title"></webobject>
    <br>
    <webobject name="Items">
      <webobject name = "Item"></webobject><br>
    </webobject>
    <webobject name="HasMore">
      <webobject name = "MoreLink"><span class = "Label"><small><webobject name = "MoreCount"></webobject> more...</small></span></webobject><br>
    </webobject>
    <div class = "Space"></div>
  </webobject>

And here is the wod:

 HasData: WOConditional {
   condition = hasData;
 };
 
 Title: SpanString {
   value = title.toUpperCase;
   isSmall = true;
   isBold = true;
   class = "Label";
 };
 
 Items: WORepetition {
   count = count;
   index = index;
 };
 
 Item: SZLink {
   value = item;
   description = description;
   altDescription = altDescription;
   href = href;
   pageName = pageName;
   isSmall = true;
   class = "Label";
 };
 
 HasMore: WOConditional {
   condition = hasMore;
 };
 
 MoreCount: SpanString {
   value = moreCount;
 };
 
 MoreLink: WOHyperlink {
   action = displayMore;
 };