Prev Home Next

17 Custom tags for rendering

TitleOrginal orderReverse order

HTML:

<td>
    {{sort languages reverse="true"}}
        <div>{{:name}}</div>
    {{/sort}}
</td>

Script:

$.views.tags({

    sort: function( array ){
        ...
        if ( this.props.reverse === "true" ) {
            // Render in reverse order
            for ( var l = array.length, i = l; i; i-- ) {
                ret += $.render( array[ i - 1 ], this.tmpl );
            }
        }
        ...
        return ret;
    }

});