Skip to content

Instantly share code, notes, and snippets.

@telagraphic
Created June 28, 2013 18:47
Show Gist options
  • Save telagraphic/5887048 to your computer and use it in GitHub Desktop.
Save telagraphic/5887048 to your computer and use it in GitHub Desktop.
I'm trying to show/hide some columns in ng-grid based on which user is viewing the page.
The visible property doesn't take a function which returns a true or false boolean?
I thought it would, but it does not. So then how would I hide/show based on certain conditions?
$scope.gridOptions = {
data: 'myData',
canSelectRows: false,
displaySelectionCheckbox: false,
footerRowHeight: 35,
showFooter: true,
showGroupPanel: true,
showColumnMenu: true,
showFilter: true,
enableColumnResize: true,
sortInfo: { fields: ['SignupDate'], directions: ['asc'] },
columnDefs: [
{ field: 'Account', displayName: 'Account Number', width: '160', visible: $scope.isUserAdmin() },
{ field: 'LineOfBusiness', displayName: 'Commodity Type', width: '130' }
]//,
//plugins: [new ngGridCsvExportPlugin()]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment