使用UIGrid和Typescript DefinitelyTyped

时间:2015-01-13 17:34:15

标签: angularjs typescript ng-grid definitelytyped

新版本的UI Grid(RC3)似乎有很多来自nggrid的体系结构更改,nggrid的musttyped文件给我带来了问题,因为它们的版本不同。

对于新版本的uigrid,是否会有一个绝对的问题?

2 个答案:

答案 0 :(得分:3)

  

是否会为新版本的uigrid

设置一个明确的类型

最后。您可以在此处请求:https://github.com/borisyankov/DefinitelyTyped/labels/Definition%3ARequest或甚至直接ping原作者:https://github.com/borisyankov/DefinitelyTyped/blob/master/ng-grid/ng-grid.d.ts#L3

答案 1 :(得分:1)

现在,您可以从Ben Tesser的两个不同来源获取typedefinition ui grid IGridOptions { useExternalSorting?: boolean; enableGridMenu?: boolean; ... }

https://github.com/btesser在nuget上,First one在github上

首次提交已于2015年7月8日完成

可能需要一些修复。

在我的例子中,在IGridOptions中添加这两个字段:

<html>
<head>
<script>

// Step One load the JSON into a variable
var Data = {"leads":[
{
"_id": "jkj238238jdsnfsj23",
"email": "foo@bar.com",
"firstName":  "John",
"lastName": "Smith",
"address": "123 Street St",
"entryDate": "2014-05-07T17:30:20+00:00"
},
{
"_id": "edu45238jdsnfsj23",
"email": "mae@bar.com",
"firstName":  "Ted",
"lastName": "Masters",
"address": "44 North Hampton St",
"entryDate": "2014-05-07T17:31:20+00:00"
},
{
"_id": "wabaj238238jdsnfsj23",
"email": "bog@bar.com",
"firstName":  "Fran",
"lastName": "Jones",
"address": "8803 Dark St",
"entryDate": "2014-05-07T17:31:20+00:00"
},
{
"_id": "jkj238238jdsnfsj23",
"email": "coo@bar.com",
"firstName":  "Ted",
"lastName": "Jones",
"address": "456 Neat St",
"entryDate": "2014-05-07T17:32:20+00:00"
},
{
"_id": "sel045238jdsnfsj23",
"email": "foo@bar.com",
"firstName":  "John",
"lastName": "Smith",
"address": "123 Street St",
"entryDate": "2014-05-07T17:32:20+00:00"
},
{
"_id": "qest38238jdsnfsj23",
"email": "foo@bar.com",
"firstName":  "John",
"lastName": "Smith",
"address": "123 Street St",
"entryDate": "2014-05-07T17:32:20+00:00"
},
{
"_id": "vug789238jdsnfsj23",
"email": "foo1@bar.com",
"firstName":  "Blake",
"lastName": "Douglas",
"address": "123 Reach St",
"entryDate": "2014-05-07T17:33:20+00:00"
},
{
"_id": "wuj08238jdsnfsj23",
"email": "foo@bar.com",
"firstName":  "Micah",
"lastName": "Valmer",
"address": "123 Street St",
"entryDate": "2014-05-07T17:33:20+00:00"
},
{
"_id": "belr28238jdsnfsj23",
"email": "mae@bar.com",
"firstName":  "Tallulah",
"lastName": "Smith",
"address": "123 Water St",
"entryDate": "2014-05-07T17:33:20+00:00"
},
{
"_id": "jkj238238jdsnfsj23",
"email": "bill@bar.com",
"firstName":  "John",
"lastName": "Smith",
"address": "888 Mayberry St",
"entryDate": "2014-05-07T17:33:20+00:00"
}]
}; 
</script>

</head>

<body>

<script type="text/javascript">

// Debug console.log
console.log(Data.leads);       // shows objects in leads array from the Data     Object
console.log(Data.leads.length);// shows the number length of the leads array


</script>


</body>
</html>