how to hide/show ng-grid column externally?

后端 未结 1 1150
甜味超标
甜味超标 2021-01-05 14:50

I am using ng-grid where i want to hide/show columns on external button click.

I tried this, but its not working



        
1条回答
  •  轮回少年
    2021-01-05 14:55

    Try using the ng-click directive

    your html button could look like this

    
    

    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()
        }
    }
    

    0 讨论(0)
提交回复
热议问题