I've got a function that creates a datasource and populates a template. I'm passing a value ("group_by") into this function that controls part of how the template displays, but I'm unsure how to use it from within the template, since it doesn't exist in the datasource.
Function:
function generateTileView(group_by) { var template_html = $('#tile_template').html(); var template = kendo.template(template_html, {useWithBlock:false}); var datasource = new kendo.data.DataSource({ transport: { read: { url: "/Controllers/MainController.cfc?method=getItems", type: "get", dataType: "json" } }, schema : { type: "json", data: "Items" } }); datasource.bind("change", function() { var view = datasource.view(); var html = kendo.render(template, view); }); datasource.read(); }What I'd like to do in the template:
<script id="tile_template" type="text/x-kendo-template"> # if (group_by == 1) { # <div class="list-items-group-content-area ui-layout-west k-widget k-listview"> <div class="list-items-content-area-heading padding k-block"> <h2>Group Header</h2> </div> # } # ..... rest of template</script>