Can someone please help me. I want to implement data display using ui-grid. But the grid is not displaying data just showing blank yet when i use table with <tr ng-repeat="transaction in savingaccountdetails.transactions>
data is displayed.
I want to use ui-grid because of the ability to have fixed header while scrolling for large data but its so hard to make table header fixed, most times columns don't align. i tried most cases but not working as expected.
My codes are as below:-
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;
});
From the above i get the following errors from web browser console:- When i use with the quotes i.e 'accountdetails' i get the error below:-
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
I don't really know why you are using the scope as "scope" and not like "$scope". I couldn't say where your problem is but maybe if you try your code this way:
Please let us know more details about your problem