Javascript Typescript剑道UI网格列类型错误

Javascript Typescript剑道UI网格列类型错误,javascript,angularjs,kendo-ui,typescript,kendo-grid,Javascript,Angularjs,Kendo Ui,Typescript,Kendo Grid,我在项目中使用Typescript时遇到剑道UI问题。我有一个网格,它的过滤模式在某些列类型上不起作用,比如integer。我试图直接在列中添加类型,但根本不起作用。 而且它也不会过滤链接 [编辑]以下是我创建网格的功能代码: private _createInfoGridOptions(): kendo.ui.GridOptions { return { dataSource: { serverPaging: true,

我在项目中使用Typescript时遇到剑道UI问题。我有一个网格,它的过滤模式在某些列类型上不起作用,比如integer。我试图直接在列中添加类型,但根本不起作用。 而且它也不会过滤链接

[编辑]以下是我创建网格的功能代码:

private _createInfoGridOptions(): kendo.ui.GridOptions {
    return {
        dataSource: {
            serverPaging: true,
            serverSorting: true,
            pageSize: 15,
        },
        resizable: true,
        selectable: 'row',
        filterable: true,
        columnMenu: true,
        sortable: true,
        scrollable: {
            virtual: true
        },
        groupable: true,
        height: 450,
        columns: [
            { field: 'subTaskId', type: "number", title: 'Subtask Id', width: '80px' },
            { field: 'reportDate', type:"date", title: 'Report Date', width: '100px', template: '#= moment.utc(reportDate).local().format("yyyy/mm/dd") #' },
            { field: 'prog', type: "string", title: 'prog',  width: '60px', template: "<a href='\\#' ng-click=\"openpopup(#=prog#, \'#=reportDate#\'\')\">#=prog#</a>" },
            { field: 'state', type:"string", title: 'status', width: '130px' },
            { field: 'maxTemps', type: 'number', title: 'Max Temps', width: '100px' }                    
        ]
    };
}
所以它在Javascript中工作,而不是在Typescript中,我使用AngularJS和剑道UI。 你知道为什么它不起作用吗

谢谢

金乌

所以它在Javascript中工作,而不是在Typescript中

您共享的typescript与您共享的JavaScript不同。具体来说,
数据源
是截然不同的。我将使TS与JS类似,这将修复错误

试试这个解决方案


$(文档).ready(函数(){
风险值数据=[{
身份证号码:36308,
报告日期:新日期(“2015/02/01”),
进步:58,
声明:“等待”,
最大温度:0
}, {
身份证号码:36309,
报告日期:新日期(“2015/02/01”),
进步:34,
声明:“完成”,
maxTemps:86400
}, {
身份证号码:36310,
报告日期:新日期(“2015/02/01”),
进展:116,
声明:“完成”,
maxTemps:86400
}, {
身份证号码:36311,
报告日期:新日期(“2015/02/02”),
进步:58,
声明:“完成”,
maxTemps:86400
}];
$(“#网格”).kendoGrid({
数据源:{
数据:数据,
模式:{
型号:{
字段:{
进展:{
类型:“编号”
},
报告日期:{
类型:“日期”
}
}
}
}
},
可滚动:对,
专栏菜单:是的,
可过滤:{
额外:错,
操作员:{
字符串:{
startswith:“以开始”,
情商:“等于”,
neq:“不等于”
}
}
},
栏目:[{
字段:“id”,
键入:“编号”,
标题:“Id”,
宽度:“80px”
}, {
字段:“reportDate”,
标题:“报告日期”,
宽度:“100px”,
格式:“{0:yyyy/MM/dd}”,
可过滤:{
用户界面:“日期选择器”
}
}, {
字段:“prog”,
标题:“Prog”,
宽度:“60px”,
模板:“”
}, {
字段:'状态',
标题:"地位",,
宽度:'130px'
}, {
字段:“maxTemps”,
键入:“编号”,
标题:“最高温度”,
宽度:“100px”
}]
});
});

是否添加了定义?定义?如果你说的是definetelytype脚本,是的,我在我的项目中添加了它们?您没有提到任何
read
url对不起,我在Javascript Plunker中举了一个例子,数据是从另一个函数收费的。div如下所示:
数据来自object source.Cool。但是
dataSource
在两者之间仍然是不同的,它不会改变过滤器的任何内容。我编辑了Plunker和我的帖子。谢谢你的帮助,你的代码比我的更干净,但对我来说不起作用。我不知道为什么,因为你的Plunker和我的一样,工作得很好。你仍然收到TypeError吗?确保你的剑道网格读取URL响应对象类型和剑道网格列字段具有相同的数据类型。它是相同的类型。id、prog、reportDate或maxTemps的int或DateTime。我真的不明白为什么这在我的网格中不起作用。
$("#grid").kendoGrid({
  dataSource: 
  {
       data : [
            {id: 36308,reportDate:"2015-02-01",prog: 58,state: "Waiting",maxTemps: 0}, 
            {id: 36309,reportDate:"2015-02-01",prog: 34,state: "Complete",maxTemps: 86400},
            {id: 36310,reportDate:"2015-02-01",prog: 116,state: "Complete",maxTemps: 86400},
            {id: 36311,reportDate:"2015-02-02",prog: 58,state: "Complete",maxTemps: 86400}
       ],
       serverPaging: true,
       serverSorting: true,
       pageSize: 15
  },
  filterable: true,
  columnMenu: true,
  columns: [
    { field: 'id', type:'number', title: 'Id', width: '80px' },
    { field: 'reportDate', title: 'Report Date', width: '100px' },
    { field: 'prog', type:'number', title: 'Prog', width: '60px' },
    { field: 'state', title: 'Status', width: '130px' },
    { field: 'maxTemps', type:'number', title: 'Max Temps', width: '100px' }
  ]
});