我正在使用凉亭(下面的json文件)。
我没有启动简单的ngGrid。这很简单(ng网格很棒,我必须说),我不知道我做错了什么。
index.jade:
div(ng-controller='Ctrl')
div(style="border: 1px solid rgb(212,212,212); width : 400px; height: 300px", ng-grid='gridOptions')
controller.coffee:
'use strict'
angular.module('client.controllers', [])
.controller('Ctrl', [
'$log'
'$scope'
($log, $scope) ->
$scope.gridOptions = {
data: 'myData'
enablePinning: true
columnDefs: [
{ field: "name", width: 120, pinned: true },
{ field: "age", width: 120 },
{ field: "birthday", width: 120 },
{ field: "salary", width: 120 }
]
}
$scope.myData = [
{ name: "Moroni", age: 50, birthday: "Oct 28, 1970", salary: "60,000" }
{ name: "Tiancum", age: 43, birthday: "Feb 12, 1985", salary: "70,000" }
{ name: "Jacob", age: 27, birthday: "Aug 23, 1983", salary: "50,000" }
{ name: "Nephi", age: 29, birthday: "May 31, 2010", salary: "40,000" }
{ name: "Enos", age: 34, birthday: "Aug 3, 2008", salary: "30,000" }
{ name: "Moroni", age: 50, birthday: "Oct 28, 1970", salary: "60,000" }
{ name: "Tiancum", age: 43, birthday: "Feb 12, 1985", salary: "70,000" }
{ name: "Jacob", age: 27, birthday: "Aug 23, 1983", salary: "40,000" }
{ name: "Nephi", age: 29, birthday: "May 31, 2010", salary: "50,000" }
{ name: "Enos", age: 34, birthday: "Aug 3, 2008", salary: "30,000" }
{ name: "Moroni", age: 50, birthday: "Oct 28, 1970", salary: "60,000" }
{ name: "Tiancum", age: 43, birthday: "Feb 12, 1985", salary: "70,000" }
{ name: "Jacob", age: 27, birthday: "Aug 23, 1983", salary: "40,000" }
{ name: "Nephi", age: 29, birthday: "May 31, 2010", salary: "50,000" }
{ name: "Enos", age: 34, birthday: "Aug 3, 2008", salary: "30,000" }
]
])
我得到的是:
bower json:
{
"name": "main",
"version": "0.0.0",
"authors": [
"gumba"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"querystring":"*",
"angular": "*",
"angular-sanitize": "*",
"angular-resource": "*",
"angular-route": "*",
"angular-cookies": "*",
"angular-mocks": "*",
"bootstrap": "*",
"sugarjs": "*",
"datatables":"*",
"ng-grid":"*"
}
}
答案 0 :(得分:0)
将ng-grid从2.0.14降级到2.0.11对我来说完成了这项工作。 我想这只是一些向后兼容性问题,将在以后的版本中解决,所以没有什么有趣的。