template

the component template

string|function template;

Example

{view:"list", template:"#id#.#title#"}

Related samples

Details

1 . Above is the common text template for template component:

2 . Data template for data-containing components:

{ view:"list", template:"#id#.#title#" }
 // the list will show ID and title of each data item from the specified datasource

3 . Function template (takes data object as a parameter):

{ view:"list", template:function(obj){
    return "<div class='overall'><div class='rank'>"
        +obj.rank+"</div>"+
        "<div class='title'>"+obj.title+"</div></div>"
}}
// the list will show rank and title of each item styled with specified CSS

4 . HTML templates defined within an HTML container:

{ view: "dataview", template:"html->template_container" }

5 . HTML template defined in the external file:

{ view:"dataview", template:"http->template.html" }

6 . Template component can load the external template by Ajax:

{ view:"template", src:"loadtext.php" }
See also
Back to top