How to hide / show ng-grid column outside?

I use ng-grid where I want the columns to hide / show when clicking on an external button.

I tried this but its not working

 $scope.gridOptions.$gridScope.columns[0].toggleVisible() 
+6
source share
1 answer

Try using the ng-click directive

Your html button might look like this:

 <input type="button" ng-click="toggleCol(0)" /> 

and your js like this

 var app = angular.module('myCoolGridApp', ['ngGrid']); app.controller('MyCtrl', function ($scope) { $scope.toggleCol= function(i) { $scope.gridOptions.$gridScope.columns[i].toggleVisible() } } 
+10
source

Source: https://habr.com/ru/post/953306/


All Articles