【问题标题】:Kendo Calendar month template - return name of class from outside function剑道日历月模板 - 从外部函数返回类的名称
【发布时间】:2016-04-05 07:33:26
【问题描述】:

我正在使用剑道日历,我必须自定义月份模板:Official Kendo Reference

问题是当我想从外部函数返回类名或自定义样式时。例如:

$("#calendar").kendoCalendar({
                    month: {
                        // template for dates in month view
                        content: '<div class="' + '#getClass(data)#' + '">#=data.value #</div>'
                    },
                    footer: false
                });

function getClass(data) {
    //do some calculation
    return "class-name";
}

但是当我使用上面的代码时,模板上没有显示返回类。

有没有办法解决这个问题?

【问题讨论】:

    标签: templates kendo-ui calendar


    【解决方案1】:

    代码应该是这样的:

    content: '<div class="' + '#=getClass(data.value)#' + '">#=data.value #</div>'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2023-04-02
      • 1970-01-01
      相关资源
      最近更新 更多