Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
How to hide igGrid columns dynamically
posted

I have a combo box with two entries for types of User : Standard and Authoriser

I have a igGrid that lists the users - a simplified view of the column definitions is shown below.  

columns: [{
key: 'UserId',
dataType: 'string',
headerText: 'User Id',
hidden: false
}, {
key: 'UserName',
dataType: 'string',
headerText: 'User Name',
hidden: false
},{
key: 'SpendLimit',
dataType: 'number',
headerText: 'Spend Limit',
hidden: false
}]

When the combo box 'Standard' option is selected I want the SpendLimit column to be hidden completely as this property is not valid for Standard users.  When the combo box 'Authoriser' option is selected I want the SpendLimit column to become visible again as this property is valid for Authorisers - each Authoriser has a spend limit.

Basically, I just want to bind to the hidden property of the SpendLimit column setting hidden to true if the Standard option is selected and setting hidden to false if the Authoriser option is selected.   

How do I do this?  (I don't want to use the hiding feature which allows the user to show or hide columns as the SpendLimit column should never be visible for the Standard users.)