Re-show hidden column in ui-grid AngularJs

I use ui-grid in one of my projects, and one of the requirements is to hide / show columns in the grid. Hiding columns works well, but then how can I show a hidden column?

After some searching, I found that in ng-grid there are showColumnMenu that provide the ability to show the column after hiding it, see this example, which I found

$scope.gridOptions = { data: 'myData', columnDefs: [{ field: "id", visible: false },{ field: "name", displayName : "name" },{ field: "age", displayname: "age", }] , multiSelect: false, showGroupPanel: true, selectedItems: [], showColumnMenu: true }; 

but in ui-grid using showColumnMenu does not work.

I was wondering if anyone knows how to show hidden columns.

Thanks,

+7
angularjs angular-ui-grid
source share
1 answer

An ng grid is written as a ui grid. Your example link points to an ng grid. But if you are wondering how to do this in angular -ui-grid.

http://plnkr.co/edit/In28bF2EYuQaATwqnBAn?p=preview Take a look at this example. To show hidden columns, you need to enable GridMenu, which will show you the ability to show hidden columns.

 $scope.gridOptions = { exporterMenuCsv: false, enableGridMenu: true, columnDefs: [ { name: 'name' }, { name: 'gender', enableHiding: false }, { name: 'company' } ], ... }; 
+12
source share

All Articles