当我将数据加载到UI格,我有这样的错误colDef.name or colDef.field property is required
UI格列definiton错误
我没有在互联网上找到一个解决方案来解决这个问题。
这是我的功能,填补了网格:因为你是使用jQuery AJAX发送HTTP请求
$scope.ApiGet = function() {
$.ajax({
url: //an url,
async: false,
type: 'POST',
dataType: 'json',
success: function (data, textStatus, xhr) {
var token = data.access_token;
console.log(token);
$.ajax({
url: //an other url
async: false,
crossDomain: true,
type: "GET",
datatype: "json",
success: function (datas, textStatus, request) {
console.log(datas[0].previewContent);
angular.forEach(datas, function (value) {
console.log(value);
debugger;
if (value) {
$scope.rowCollection = $scope.rowCollection.concat(value.previewContent);
}
})
// console.log($scope.rowCollection);
},
error: function (jqXHR, textStatus, errorThrown) {
// $scope.addAlert(jqXHR.responseText != "" ? jqXHR.responseText : jqXHR.statusText);
}
})
和HTML
<div ng-controller="listCtrl" ng-init="ApiGet()">
<div ui-grid="{ data: rowCollection }" class="myGrid"></div>
</div>
我的要求是异步=假,所以当我加入$范围$适用(),它说我$文摘已在进行中,所以我把请求异步=。真的,那么我有同样的错误。我试图用colum定义创建gridOption,但仍然是相同的 –