www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Resources API Reference Mojo.View.render(renderParams)

Mojo.View.render(renderParams)

Create HTML markup from one or more objects.

Parameter Type Description
renderParams Object Rendering options.  See below.

renderParams object properties:

Property Type Description
object Object Object to use to resolve property references in the template.
collection Array List of objects to bind individually to a template to create a list.
attributes Object Additional object used to resolve property references when the property does not exist in object or the appropriate collection element.
formatters Object Hash of property names to formatter functions to be applied before rendering.  See Mojo.Model.format().
tempate String Partial or full path to the template.
separator String Partial or full path to template to use as a separator between individual list elements.

Example usage:

 html = Mojo.View.render(
  {
    object: {
      count: this.targetEventAttendees.attendees.size()
    }, 
    template: 'participants/participant-count'
  }
)
 this.controller.get('partv_count_div').update(html);

Example usage 2:

 var theDate = new Date(date);
            
 var y = Mojo.Format.formatDate(theDate, "yyyy");
 var m = Mojo.Format.formatDate(theDate, "MMM").toUpperCase();
 var d = Mojo.Format.formatDate(theDate, "dd");
 var button = Mojo.View.render({object: {label: $L("Date"), year: y, month: m, day: d},
                                template: "datetime/datePicker"});
 dateDiv.insert(button);
 var items = dateDiv.childElements();
 button = items[items.size() - 1];

Example usage 3:

 var content = Mojo.View.render({collection: songs,
             template: 'list/song', separator: 'list/separator''})
listElement.innerHTML = content;
 

0 Comments

    Add Comment


      • >:o
      • :-[
      • :'(
      • :-(
      • :-D
      • :-*
      • :-)
      • :P
      • :\
      • 8-)
      • ;-)