无法使用Knockout Kendo JS绑定自定义Kendo Calendar Month模板 [英] Unable to Customize Kendo Calendar Month templates with Knockout Kendo JS Binding
问题描述
我已经自定义Kendo Calendar Month Template
参考,发现在此处 with out knockout-kendo.js
.来自此处的官方Kendo参考.
I have customized the Kendo Calendar Month Template
Reference found Here with out knockout-kendo.js
. Official Kendo Reference from Here.
问题是当我在knockout-kendo.js binding its not getting compiled
中使用以下代码时.看看这个 Knockout-kendo.js
,日历位于小提琴的地方.如果我删除了month view template code
,它的工作原理.我该如何使用敲除kendo.js解决这个问题?
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());
},
});
错误如下:
那么,问题是如何在Knockout-Kendo.js绑定中使用月视图?
So, the Question is How to Use Month View in Knockout-Kendo.js binding?
更新:
推荐答案
在Kendo模板中,您需要转义引号.因此,您可以使用"
而不是仅使用"
.
Inside of your Kendo Template you need to escape your quotes. So, you can use "
rather than just the "
.
赞:
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.
以下是更新的小提琴: http://jsfiddle.net/rniemeyer/bfycstr4/
Here is an updated fiddle: http://jsfiddle.net/rniemeyer/bfycstr4/
这篇关于无法使用Knockout Kendo JS绑定自定义Kendo Calendar Month模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!