簡體   English   中英

ui-grid未顯示數據angularjs

[英]ui-grid not showing data angularjs

有人可以幫幫我嗎。 我想使用ui-grid實現數據顯示。 但是,當我<tr ng-repeat="transaction in savingaccountdetails.transactions>數據<tr ng-repeat="transaction in savingaccountdetails.transactions>表與<tr ng-repeat="transaction in savingaccountdetails.transactions>一起使用時,表仍未顯示數據。

我想使用ui-grid,因為在滾動大數據時能夠具有固定的標頭,但是很難使表格標頭固定,多數情況下列不對齊。 我嘗試了大多數情況,但沒有按預期工作。

我的代碼如下:

var columnsUiGrid = [
                { displayName: 'Value Date', field: 'accountdetails.transactions.date'},
                { displayName: 'Seq', field: 'accountdetails.transactions.id'},
                { displayName: 'Number', field: 'accountdetails.transactions.transactionCode'},
                { displayName: 'Type', field: 'accountdetails.transactions.transactionCode'},
                { displayName: 'Debit', field: 'accountdetails.transactions.amount'},
                { displayName: 'Credit', field: 'accountdetails.transactions.amount'},
                { displayName: 'Balance', field: 'accountdetails.transactions.runningBalance'},
                { displayName: 'Tlr#', field: 'accountdetails.transactions.teller'},
                { displayName: 'Reference', field: 'accountdetails.transactions.referenceCode'},
                { displayName: 'Description', field: 'accountdetails.transactions.description'}
            ];
            scope.gridOptions = {
                columnDefs: columnsUiGrid,
                enableSorting: false,
                enableColumnMenus: false,
                enableRowSelection: true,
                enableRowHeaderSelection : false,
                multiSelect: false,
                data: 'accountdetails'
            };

resourceFactory.savingsResource.get({accountId: routeParams.id, associations: 'all'}, function (data) {
                scope.accountdetails = data;
            });

從上面我從網絡瀏覽器控制台中收到以下錯誤:-當我使用引號即“ accountdetails”時,出現以下錯誤:-

angular.js:9400 TypeError: d.$applyAsync is not a function
    at h (http://localhost:9000/bower_components/angular-ui-grid/ui-grid.min.js:7:2757)
    at post (http://localhost:9000/bower_components/angular-ui-grid/ui-grid.min.js:7:4152)
    at http://localhost:9000/bower_components/angular/angular.js:6602:44
    at nodeLinkFn (http://localhost:9000/bower_components/angular/angular.js:6224:13)
    at http://localhost:9000/bower_components/angular/angular.js:6414:13
    at http://localhost:9000/bower_components/angular/angular.js:7559:11
    at wrappedCallback (http://localhost:9000/bower_components/angular/angular.js:10930:81)
    at http://localhost:9000/bower_components/angular/angular.js:11016:26
    at Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:11936:28)
    at Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:11762:31) <div ui-i18n="en" class="influxGrid ui-grid ng-isolate-scope grid1505208757076" id="transactionGrid" ui-grid-selection="" ui-grid="gridOptions" style="height: 340px;">
(anonymous) @ angular.js:9400
(anonymous) @ angular.js:6836
nodeLinkFn @ angular.js:6227
(anonymous) @ angular.js:6414
(anonymous) @ angular.js:7559
wrappedCallback @ angular.js:10930
(anonymous) @ angular.js:11016
$eval @ angular.js:11936
$digest @ angular.js:11762
$apply @ angular.js:12042
(anonymous) @ angular.js:13575
completeOutstandingRequest @ angular.js:4109
(anonymous) @ angular.js:4416
angular.js:9400 TypeError: b.forEach is not a function
    at p.modifyRows (ui-grid.min.js:7)
    at ui-grid.min.js:7
    at wrappedCallback (angular.js:10930)
    at angular.js:11016
    at Scope.$eval (angular.js:11936)
    at Scope.$digest (angular.js:11762)
    at Scope.$apply (angular.js:12042)
    at angular.js:13575
    at completeOutstandingRequest (angular.js:4109)
    at angular.js:4416

我真的不知道為什么將示波器用作“ scope”而不是“ $ scope”。 我不能說您的問題出在哪里,但也許如果您這樣嘗試代碼:

var columnsUiGrid = [
            { displayName: 'Value Date', field: 'accountdetails.transactions.date'},
            { displayName: 'Seq', field: 'accountdetails.transactions.id'},
            { displayName: 'Number', field: 'accountdetails.transactions.transactionCode'},
            { displayName: 'Type', field: 'accountdetails.transactions.transactionCode'},
            { displayName: 'Debit', field: 'accountdetails.transactions.amount'},
            { displayName: 'Credit', field: 'accountdetails.transactions.amount'},
            { displayName: 'Balance', field: 'accountdetails.transactions.runningBalance'},
            { displayName: 'Tlr#', field: 'accountdetails.transactions.teller'},
            { displayName: 'Reference', field: 'accountdetails.transactions.referenceCode'},
            { displayName: 'Description', field: 'accountdetails.transactions.description'}
        ];
        $scope.gridOptions = {
            columnDefs: columnsUiGrid,
            enableSorting: false,
            enableColumnMenus: false,
            enableRowSelection: true,
            enableRowHeaderSelection : false,
            multiSelect: false,
            data: $scope.accountdetails
        };
resourceFactory.savingsResource.get({accountId: routeParams.id, associations: 'all'}, function (data) {
                $scope.accountdetails = data;
            });

請讓我們知道有關您的問題的更多詳細信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM