我的項目中使用Typescript的Kendo UI有問題。我有一個網格過濾模式不適用於某些列類型,如整數。我試圖直接在列中添加類型,但它根本不起作用。 而且它也沒有過濾鏈接。Typescript Kendo UI網格列類型錯誤
[編輯]這裏是我的功能代碼,創建網格:
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' }
]
};
}
我對Chrome的這個錯誤:
Uncaught TypeError: (d.prog || "").toLowerCase is not a function
而這一次在Firefox:
TypeError: "".toLowerCase is not a function.
我做了一個plunker來測試我的代碼翻譯在JavaScript中,但類型屬性的作品。
$("#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' }
]
});
所以它在Javascript中工作,但不是在Typescript中,我使用Kendo UI的AngularJS。 任何想法,爲什麼它不是woking?
謝謝!
Ginwu
你加的定義? – indapublic 2015-03-31 07:21:59
定義?如果你在談論DefinetelyTyped腳本,是的,我將它們添加到我的項目中。 – Ginwu 2015-03-31 07:55:48
數據源中生成的數據來自哪裏?你沒有提到任何'讀'URL – mshaaban 2015-03-31 09:13:39