0

我已经定制了在这里Kendo Calendar Month Template找到的参考。官方剑道参考从这里 with out knockout-kendo.js

问题是当我在knockout-kendo.js binding its not getting compiled. Knockout-kendo.js用 Calendar at fiddle看看这个。如果我删除month view template code,它的工作。我如何用 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 绑定中使用月视图?

更新:

错误

4

1 回答 1

1

在您的剑道模板中,您需要转义您的报价。因此,您可以使用&quot;而不仅仅是".

像:

content: '# if (isInArray(data.date, data.dates, data) == &quot;failure&quot;) { #' +
                                 '<div class=&quot;failure&quot;>' + '#= data.value #' + '</div>' +
                             '# } #' +
                             '# if (isInArray(data.date, data.dates, data) == &quot;success&quot;) { #' +
                                 '<div class=&quot;success&quot;>' + '#= data.value #' + '</div>' +
                             '# } #' +
                             '# if (isInArray(data.date, data.dates, data) == &quot;none&quot;) { #' +
                                 '<div class=&quot;none&quot;>' + '#= data.value #' + '</div>' +
                             '# } #'

如果有帮助,您可以将模板字符串移动到您的视图模型中。

这是一个更新的小提琴:http: //jsfiddle.net/rniemeyer/bfycstr4/

于 2014-09-08T12:57:14.187 回答