ng-grid

How to mock ng-grid when unit testing a controller

夙愿已清 提交于 2019-12-03 08:37:40
I'm currently trying to write tests for existing blocks of code and running into an issue with a controller that has a nested ng-grid inside of it. The issue comes from the controller trying to interact with the grid on initialization. Testing Software node@0.10.14 karma@0.10.2 karma-jasmine@0.1.5 karma-chrome-launcher@0.1.2 My Test: define(["angularjs", "angular-mocks", "jquery", "js/3.0/report.app", "js/3.0/report.controller", "js/3.0/report.columns" ], function(angular, ngMocks, jquery, oARModule, oARCtrl, ARColumns) { "use strict"; describe("Report Center Unit Tests", function() { var

Exporting ng-grid data to CSV and PDF format in angularjs

允我心安 提交于 2019-12-03 07:56:48
问题 Please Help me....any plugin is there..? I have searched for exporing excel and PDF in angularjs. using ng-grid. Exporting ng-grid data to CSV and PDF format in angularjs 回答1: For csv export there is the ngGridCsvExportPlugin that you can find here Just at a reference to the script and add the ngGridCsvExportPlugin to the gridOptions (and activate the footer too by adding showFooter : true to the gridOption) $scope.gridOptions = { data: 'myData', plugins: [new ngGridCsvExportPlugin()],

Is it possible to have a select drop down inside of the AngularJS ng-grid?

丶灬走出姿态 提交于 2019-12-03 07:34:36
问题 I have coded the following: $scope.gridOptions = { data: 'myData', enableCellEdit: true, multiSelect: false, columnDefs: [ { field: 'Id', displayName: 'Id' }, { field: 'Name', displayName: 'Name', enableCellEdit: true, editableCellTemplate: cellEditableTemplate }, { field: 'Description', displayName: 'Description', enableCellEdit: true, editableCellTemplate: cellEditableTemplate } ] }; The myData actually contains four colums Id, Name, Status and Description. Where status is a simple

how to create a nggrid custom footer

女生的网名这么多〃 提交于 2019-12-03 02:33:11
I want to enable footers for ng-grid but I want to completely customize it and override what ng-grid does by default. Basically, I just want a 'Load more...' link at at the bottom of the grid that will load more rows from the server according to what pagingOptions.pageSize is set to and append it to the bottom of the grid while dynamically expanding the viewport height so there is no scrollbar. Is there a configuration hook for this, or where/how can I do this? Thanks. Although it is not listed in the API section of the ng-grid website, you can define a custom $scope.gridOptions.footerTemplate

Ng-grid Cannot set property 'gridDim' of undefined

匿名 (未验证) 提交于 2019-12-03 00:50:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new in Angular, and I try to declare gridOption for ng-grid Within a function in costroller. It cause an error: TypeError: Cannot set property 'gridDim' of undefined I tried to solve it using $scope.apply and ng-if in template. But nothing from this is working for me. Thanks for any advice: method of the Controller: $scope.getTest = function() { $http.get('http://www.iNorthwind.com/Service1.svc/getAllCustomers') .success(function (data, status, headers, config) { //$scope.myData = data; console.log('Sucess' + data); // definition for ng

ngGrid - remove row

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 00:17:54
I have been looking for an example on how to implement a button to remove a selected row, but I couldn't find anything useful so far. Can anyone please give me a hint? Here is the plunker example. The function I implement acts weird, as it removes other rows. Thank you. That is not a proper way to delete any row Try like this: $scope.removeRow = function() { var index = this.row.rowIndex; $scope.gridOptions.selectItem(index, false); $scope.myData.splice(index, 1); }; PLUNKER --> Its working and tested thanks for the hint but I tried the snippet and it doesn't work so I changed it in var

Get Ajax data into Angular grid

依然范特西╮ 提交于 2019-12-02 22:28:15
Using Angular Grid, I get the ajax get data in console.log. But an empty grid. The console log reads: [13:56:11.411] now!! [13:56:11.412] [] [13:56:11.412] now!! [13:56:11.556] <there is data returned from console.log(getData); > This is the js file. // main.js var app = angular.module('myApp', ['ngGrid']); var getData = []; function fetchData() { var mydata = []; $.ajax({ url:'/url/to/hell', type:'GET', success: function(data) { for(i = 0, j = data.length; i < j; i++) { mydata[i] = data[i]; } getData = mydata; console.log(getData); } }); } fetchData(); app.controller('MyCtrl', function($scope

Is it possible to have a select drop down inside of the AngularJS ng-grid?

怎甘沉沦 提交于 2019-12-02 21:02:51
I have coded the following: $scope.gridOptions = { data: 'myData', enableCellEdit: true, multiSelect: false, columnDefs: [ { field: 'Id', displayName: 'Id' }, { field: 'Name', displayName: 'Name', enableCellEdit: true, editableCellTemplate: cellEditableTemplate }, { field: 'Description', displayName: 'Description', enableCellEdit: true, editableCellTemplate: cellEditableTemplate } ] }; The myData actually contains four colums Id, Name, Status and Description. Where status is a simple javascript array with three types of status called myStatus. Is it possible for me to somehow link in the data

Angular ng-grid declare gridOptions in function

谁都会走 提交于 2019-12-02 18:11:31
问题 I'm new to Angular, and I'm trying to declare gridOption for ng-grid within a function, because I don't want it to fire before the data comes from the server. But if I do so, it cause an error: TypeError: Cannot set property 'gridDim' of undefined What is going on? 回答1: To stop rendering till the data arrives do something like <div ng-if="contentAvailable"> <ng-grid/> </div> In you controller when the data is available setup the gridoptions object, followed by contentAvailable to true. 来源:

Scope confusion in ng-grid when returning data from modal

牧云@^-^@ 提交于 2019-12-02 02:22:36
问题 Here is the Plunker: http://plnkr.co/edit/aqLnno?p=preview I have a list of persons ( $scope.persons ) to be displayed in a ng-grid. Each line has a edit button. When the user clicks on the button ( ng-click="edit(row)" ) (see code below), I copy the displayed person ( angular.copy(row.entity) ) and open a modal dialog. ... so far so good. When the user clicks "Cancel" on the modal, nothing happens. When the user clicks "Save" on the model, the modified person is returned and should be