1

Imagine that i have the structure below:

      $scope.gridOptions = {
                enableHorizontalScrollbar: 1,
                enableFiltering: true,
                paginationPageSizes: [150, 300, 450],
                paginationPageSize: 150,
                rowHeight: 110,
                data: data,
                columnDefs: [
{  name: 'IdQuestion', field: 'IdQuestion', displayName: 'Question Number' , enableCellEdit: false  , width :'60' },         
{  name: 'Category', field: 'Category', displayName: 'Category' , enableCellEdit: false  , width :'83'  }

I need to create a button in order to hide the Category column, i was thinking that this would work :/

 $("#gridOptions").field("Category").hide();

but it didn't , can you guys let me know the correct way to access to the category column. Thanks in advance.

2
  • 1
    You're mixing jQuery and angular here. Usually you can do such a thing completely from within angular using 'ng-hide' or 'ng-show' directives. Use your button to toggle the bound value on these maybe? Commented May 30, 2016 at 10:05
  • thanks Gunter, I'm looking for a good example for such thing, do you have any one ? Commented May 30, 2016 at 10:12

1 Answer 1

1
<label ng-show="gridOptions[0].enableCellEdit">Category</label>

in the above code if enableCellEdit is true then that label will show other wise it will hide.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks thigala , how can i add it into the column definition , will this work : name: 'Category', field: 'Category', displayName: 'Category' , enableCellEdit: false , width :'83', ng-show: "gridOptions[0].enableCellEdit" }

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.