8

I am using ui-grid in one of my projects and one of the requirement is to hide/show columns in the grid. Hiding columns working well but then how can I re-show the hidden column?

After searching awhile I found that in ng-grid there is showColumnMenu which provide the ability to show column after hiding it, see this example 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 is not working.

I was wondering if someone know how to show hidden columns.

Thanks,

0

1 Answer 1

15

ng-grid is being re written as ui-grid. Your example link is pointing to 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 the hidden the columns, you need to enableGridMenu, which will show you the option to show the hidden columns.

$scope.gridOptions = {
    exporterMenuCsv: false,
    enableGridMenu: true,        
    columnDefs: [
      { name: 'name' },
      { name: 'gender', enableHiding: false },
      { name: 'company' }
    ],
    ...
  };
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Kanthir for your useful help.I added that example in ng-grid just for make myself clear for what I really want. I was searching for the equivalent of showColumnMenu in ui-grid but I did not find it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.