Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kendo ui 扩展剑道';s AgendaView(来自调度程序)使用TypeScript_Kendo Ui_Typescript - Fatal编程技术网

Kendo ui 扩展剑道';s AgendaView(来自调度程序)使用TypeScript

Kendo ui 扩展剑道';s AgendaView(来自调度程序)使用TypeScript,kendo-ui,typescript,Kendo Ui,Typescript,我正在尝试使用typescript扩展剑道调度程序 下面是一个使用JS的工作示例: 但我不能用打字机 我想我很接近: var CustomAgenda = (<any>kendo.ui).AgendaView.extend( { endDate: () => { var self = this; var d = (<any>kendo.ui).AgendaView.fn.endDate.call(self);

我正在尝试使用typescript扩展剑道调度程序

下面是一个使用JS的工作示例:

但我不能用打字机

我想我很接近:

var CustomAgenda = (<any>kendo.ui).AgendaView.extend(
{
    endDate: () =>
    {
        var self = this;
        var d = (<any>kendo.ui).AgendaView.fn.endDate.call(self);
        return (<any>kendo).date.addDays(d, 21);
    }
});
var CustomAgenda=(kendo.ui).AgendaView.extend(
{
结束日期:()=>
{
var self=这个;
var d=(kendo.ui.AgendaView.fn.endDate.call(self);
返回(剑道)。日期。添加日期(d,21);
}
});
但很明显,我的“这个”提法是错误的。剑道打字文件也没有公开kendo.date或AgendaView,这使得事情有点混乱


可能是我弄错了,这确实让人觉得很难看…

在这种情况下,您不想在
endDate
函数之外捕获
this
。所以只需使用
函数
,而不是
()=>

var CustomAgenda = (<any>kendo.ui).AgendaView.extend(
{
    endDate: function()
    {
        var self = this;
        var d = (<any>kendo.ui).AgendaView.fn.endDate.call(self);
        return (<any>kendo).date.addDays(d, 21);
    }
});

var CustomAgenda=(

以下是我根据剑道论坛上对另一个问题的回答提出的一个更“类型脚本”的方法。它使用datejs,但可以很容易地进行调整,以便在没有datejs的情况下工作

/// <reference path="../../typings/datejs/datejs.d.ts" />

declare module kendo.ui
{
    class AgendaView implements kendo.ui.SchedulerView
    {
        startDate(): IDateJS;
        endDate(): IDateJS;
    }
}

class MonthlyAgendaView extends kendo.ui.AgendaView
{
    endDate(): IDateJS
    {
        var date = this.startDate().clone();
        date.moveToLastDayOfMonth();
        return date;
    }
}
//
声明模块kendo.ui
{
类AgendaView实现kendo.ui.SchedulerView
{
startDate():IDateJS;
endDate():IDateJS;
}
}
类monthlyangendaview扩展了kendo.ui.AgendaView
{
endDate():IDateJS
{
var date=this.startDate().clone();
date.moveToLastDayOfMonth();
返回日期;
}
}