ng-grid

Getting select rows from ng-grid?

社会主义新天地 提交于 2019-11-29 01:43:13
How do I create (or access) an array of selected rows in my ng-grid ? Documentation (scroll to "Grid options") id | default value | definition ----------------------------------------------- selectedItems | [] | all of the items selected in the grid. In single select mode there will only be one item in the array. index.html <body ng-controller="MyCtrl"> <div class="gridStyle" ng-grid="gridOptions"></div> <h3>Rows selected</h3> <pre>{{selectedItems}}</pre> </body> main.js var app = angular.module('myApp', ['ngGrid']); app.controller('MyCtrl', function($scope) { $scope.myData = [{name: "Moroni",

insert ng-click event into ng-grid

风格不统一 提交于 2019-11-28 23:51:49
i want to do something that i don't know if it is possible HTML <!DOCTYPE html> <html ng-app="myApp"> <head lang="en"> <meta charset="utf-8"> <title>Custom Plunker</title> <link rel="stylesheet" type="text/css" href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script> <script type="text/javascript" src="http://angular-ui.github.com/ng-grid/lib/ng-grid

is there a way to auto adjust widths in ng-grid?

☆樱花仙子☆ 提交于 2019-11-28 18:19:05
I'm having trouble with widths of my columns. I don't know what width they will be beforehand, nor do I want to specify each column's width. Is there an attribute that I can use that auto adjusts all the column widths based on the content (including the column header)? Woot! I came up with a pretty cool answer! Setting the width to "auto" was really not working for me. Maybe it is because I'm using an ng-view ? Not sure. So I created 2 new functions you can put in your controller.js . Using them like this will give you computed column widths! Read the code comments; there are some caveats.

AngularJS (ng-grid) “editableCellTemplate” remains in edit mode on loss of focus

半城伤御伤魂 提交于 2019-11-28 12:12:53
In the latest version of ng-grid(v2.0.7), when a editableCellTemplate is in edit mode and loses focus, it remain in edit mode. Is this a bug or did I configure the grid incorrectly? Here's an example: http://plnkr.co/edit/OgEjk7wFaC982FrKbeHH?p=preview where column 0 contains the editableCellTemplate. I found the answer in one of the templates inside of ng-grid.js. I was missing ng-input="COL_FIELD" <select ng-cell-input ng-class="'colt' + $index" ng-input="COL_FIELD" ng-model="COL_FIELD"> <option>nl</option> <option>fr</option> <option>en</option> </select> 来源: https://stackoverflow.com

Angular ng-grid row height

a 夏天 提交于 2019-11-28 08:14:12
is there any way to apply the height of the row in ng-grid according to its content. there is one option rowHeight which is changed the height of all row. But I want dynamic row height according to its content. Following is the Plunker I have made, in this I have used cellTemplate to insert Education field, But I want to increase the row height according to education field detail. http://plnkr.co/edit/tQJNpB?p=preview According to this link it is not possible: [1] https://github.com/angular-ui/ng-grid/issues/157 But if anyone find the solution..... These classes will make the table act as

AngularJS/ng-grid - Updating array with splice doesn't updates UI

守給你的承諾、 提交于 2019-11-28 00:46:48
问题 I am trying to update ng-grid with array splice . I have a plunk here . Add button adds new row. Update button updates last item in the array. Select a row & press update button. Nothing happens. Press add button. Now UI gets updated with new element & as well as the previously updated element. Same behavior gets repeated again & again. I tried $scope.$apply . I get: “Error: $apply already in progress” I even tried by placing $scope.$apply block inside a setTimeout call. Again the same error!

How to set aggregation with grouping in ng-grid

瘦欲@ 提交于 2019-11-27 18:38:26
I want to see totals (or generally any aggregation function) for each group in a grid. This was requested and closed as done in issue: https://github.com/angular-ui/ng-grid/issues/95 (but unfortunately without any example). I am able to redefine default template https://github.com/angular-ui/ng-grid/blob/master/src/templates/aggregateTemplate.html by aggregateTemplate config option. But I don't know how to extend it properly. This template is evaluating in ng-grid scope and I don't know how to trigger my custom aggregation function. I want to create similar function as '''totalChildren'''

insert ng-click event into ng-grid

Deadly 提交于 2019-11-27 15:17:37
问题 i want to do something that i don't know if it is possible HTML <!DOCTYPE html> <html ng-app="myApp"> <head lang="en"> <meta charset="utf-8"> <title>Custom Plunker</title> <link rel="stylesheet" type="text/css" href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular

is there a way to auto adjust widths in ng-grid?

岁酱吖の 提交于 2019-11-27 11:14:50
问题 I'm having trouble with widths of my columns. I don't know what width they will be beforehand, nor do I want to specify each column's width. Is there an attribute that I can use that auto adjusts all the column widths based on the content (including the column header)? 回答1: Woot! I came up with a pretty cool answer! Setting the width to "auto" was really not working for me. Maybe it is because I'm using an ng-view ? Not sure. So I created 2 new functions you can put in your controller.js .

AngularJS and ng-grid - auto save data to the server after a cell was changed

拈花ヽ惹草 提交于 2019-11-27 10:52:15
My Use Case is pretty simple. A User, after editing a Cell (enableCellEdit: true), should have the data "automatically" sent to the server (on cell blur). I tried different approaches but none of them have properly worked out. I have a minimalistic grid: // Configure ng-grid $scope.gridOptions = { data: 'questions', enableCellSelection: true, selectedItems: $scope.selectedRow, multiSelect: false, columnDefs: [ {field: 'id', displayName: 'Id'}, {field: 'name', displayName: 'Name'}, {field: 'answers[1].valuePercent', displayName: 'Rural', enableCellEdit: true} ] }; For example, I tried to watch