问题
I have customized the Kendo Calendar Month Template
Reference found Here with out knockout-kendo.js
. Official Kendo Reference from Here.
The problem is when i use the below code in knockout-kendo.js binding its not getting compiled
. Take a look at this Knockout-kendo.js with Calendar at fiddle. If i remove the month view template code
, its working. How do i resolve this with knockout-kendo.js?
$("#calendar").kendoCalendar({
dates: birthdays,
month: {
// template for dates in month view
content: '# if (isInArray(data.date, data.dates, data) == "failure") { #' +
'<div class="failure">' + '#= data.value #' + '</div>' +
'# } #' +
'# if (isInArray(data.date, data.dates, data) == "success") { #' +
'<div class="success">' + '#= data.value #' + '</div>' +
'# } #' +
'# if (isInArray(data.date, data.dates, data) == "none") { #' +
'<div class="none">' + '#= data.value #' + '</div>' +
'# } #'
},
change: function () {
scheduler.date(this.value());
},
});
The Error is below :
So, the Question is How to Use Month View in Knockout-Kendo.js binding?
Update:
回答1:
Inside of your Kendo Template you need to escape your quotes. So, you can use "
rather than just the "
.
Like:
content: '# if (isInArray(data.date, data.dates, data) == "failure") { #' +
'<div class="failure">' + '#= data.value #' + '</div>' +
'# } #' +
'# if (isInArray(data.date, data.dates, data) == "success") { #' +
'<div class="success">' + '#= data.value #' + '</div>' +
'# } #' +
'# if (isInArray(data.date, data.dates, data) == "none") { #' +
'<div class="none">' + '#= data.value #' + '</div>' +
'# } #'
You can move the template string into your view model, if it helps.
Here is an updated fiddle: http://jsfiddle.net/rniemeyer/bfycstr4/
来源:https://stackoverflow.com/questions/25721306/unable-to-customize-kendo-calendar-month-templates-with-knockout-kendo-js-bindin