我正在使用ng-grid
我想在外部按钮单击时隐藏/显示列的位置。
我试过这个,但它不工作
$scope.gridOptions.$gridScope.columns[0].toggleVisible()
Try using the ng-click directive
your html button could 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()
}
}