I am using a simple template and rendering the html using $("#main").html(kendo.render(template, repairs));. Since I am just dealing with local data, I felt there was no need for a datasource, but when I add an item to the repair array I would like to have it update the html via the template. I am using $("#main").html(kendo.render(template, repairs)); again to do that right now, but is there a better way? Thanks.
Wade
Wade
<
script
id
=
"template"
type
=
"text/x-kendo-template"
>
<
div
id
=
"content"
>
<
div
id
=
"RepairNum"
>
Repair:#= RepairNum #
Customer:#= CustomerName #
</
div
>
</
div
>
</
script
>
<
script
>
function Repair(repairNum,customerName) {
this.RepairNum = repairNum;
this.CustomerName = customerName;
}
var repairs = new Array();
repairs.push(new Repair("111111","Test1"));
repairs.push(new Repair("222222","Test2"));
repairs.push(new Repair("333333","Test3"));
$(document).ready(function() {
var template = kendo.template($("#template").html());
$("#main").html(kendo.render(template, repairs));
$("#addButton").click(function(){
//Attempt to get the customer name
var repairNum = $("#repairnum").val();
$.get('/app/json.mx', {RepairNum : repairNum},
function(data)
{
repairs.push(new Repair(repairNum,data));
$("#main").html(kendo.render(template, repairs));
});
$("#repairnum").val("");
$("#repairnum").focus();
});
});
</
script
>