我正在從Django的這個JSON和我想的角度UI的表格顯示這一點,但我得到的錯誤:如何顯示從JSON來UI網格數據角度UI網
Error: colDef.name or colDef.field property is required
[email protected]://127.0.0.1:8000/static/buddy/js/ui-grid.js:3771:1
buildColumns/<@http://127.0.0.1:8000/static/buddy/js/ui-grid.js:3630:7
[email protected]://127.0.0.1:8000/static/buddy/js/ui-grid.js:3629:5
[email protected]://127.0.0.1:8000/static/buddy/js/ui-grid.js:2749:27
[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:15693:13
$RootScopeProvider/this.$get</[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:15826:23
$RootScopeProvider/this.$get</[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:16097:13
[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:10546:36
[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:10744:7
[email protected]://127.0.0.1:8000/static/buddy/js/angular.js:10685:1
我要只顯示來自「域」
的JSON是屬性:
[{"fields": {"joiningtime": null, "boozprofileId": 1, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 1}, {"fields": {"joiningtime": null, "boozprofileId": 1, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 2}, {"fields": {"joiningtime": "2015-10-18T15:53:58.243Z", "boozprofileId": 12, "userId": 3, "likeStatus": true}, "model": "buddy.guestentry", "pk": 3}, {"fields": {"joiningtime": "2015-10-18T15:54:24.055Z", "boozprofileId": 8, "userId": 3, "likeStatus": true}, "model": "buddy.guestentry", "pk": 4}, {"fields": {"joiningtime": null, "boozprofileId": 3, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 5}, {"fields": {"joiningtime": null, "boozprofileId": 3, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 6}, {"fields": {"joiningtime": null, "boozprofileId": 3, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 7}, {"fields": {"joiningtime": null, "boozprofileId": 3, "userId": 1, "likeStatus": true}, "model": "buddy.guestentry", "pk": 8}]
現在我得到錯誤intialize它:需要colDef.name或colDef.field財產 – focode
@focode - 你這樣做之前, - 「_colDef.name或colDef.field屬性是必需的」 - 如果你顯示你的代碼,它會容易得多,也許你對標記有問題。你是否從plnkr複製了這個計劃?它應該馬上工作,就像'$ http'一樣。 – davidkonrad
我不能在這裏複製過去,這裏是它的github鏈接...控制器名稱是ajax:https://github.com/focode/buddy2/blob/master/src/static/buddy/js/ main.js – focode