Skip to content

Commit

Permalink
fix(move-columns): Replace with .
Browse files Browse the repository at this point in the history
Also, updated tutorial to follow angular styleguide standards.
  • Loading branch information
Portugal, Marcelo authored and mportuga committed Jan 15, 2018
1 parent 30af7e9 commit f77df14
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
29 changes: 15 additions & 14 deletions misc/tutorial/217_column_moving.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@ Columns can be repositioned by either dragging and dropping them to specific pos
<example module="app">
<file name="app.js">
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.moveColumns']);
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.gridOptions = {
app.controller('MainCtrl', function ($scope, $http) {
var vm = this;

vm.gridOptions = {
columnDefs: [
{ name: 'id'},
{ name: 'name'},
{ name: 'age'},
{ name: 'gender'},
{ name: 'email'},
]
};

$scope.gridOptions.columnDefs = [
{ name: 'id'},
{ name: 'name'},
{ name: 'age'},
{ name: 'gender'},
{ name: 'email'},
];

$http.get('/data/500_complex.json')
.then(function(response) {
$scope.gridOptions.data = response.data;
vm.gridOptions.data = response.data;
});
}]);
});
</file>
<file name="main.css">
.grid {
Expand All @@ -50,8 +51,8 @@ Columns can be repositioned by either dragging and dropping them to specific pos
}
</file>
<file name="index.html">
<div ng-controller="MainCtrl">
<div class="grid" ui-grid="gridOptions" ui-grid-move-columns></div>
<div ng-controller="MainCtrl as $ctrl">
<div class="grid" ui-grid="$ctrl.gridOptions" ui-grid-move-columns></div>
</div>
</file>
</example>
4 changes: 2 additions & 2 deletions src/features/move-columns/js/column-movable.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @name ui.grid.moveColumns.service:uiGridMoveColumnService
* @description Service for column moving feature.
*/
module.service('uiGridMoveColumnService', ['$q', '$timeout', '$log', 'ScrollEvent', 'uiGridConstants', 'gridUtil', function ($q, $timeout, $log, ScrollEvent, uiGridConstants, gridUtil) {
module.service('uiGridMoveColumnService', ['$q', '$rootScope', '$log', 'ScrollEvent', 'uiGridConstants', 'gridUtil', function ($q, $rootScope, $log, ScrollEvent, uiGridConstants, gridUtil) {

var service = {
initializeGrid: function (grid) {
Expand Down Expand Up @@ -202,7 +202,7 @@
columns[newPosition] = originalColumn;
service.updateColumnCache(grid);
grid.queueGridRefresh();
$timeout(function () {
$rootScope.$applyAsync(function () {
grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
grid.api.colMovable.raise.columnPositionChanged(originalColumn.colDef, originalPosition, newPosition);
});
Expand Down

0 comments on commit f77df14

Please sign in to comment.