I need to remove some columns on condition of user login. I have created a grid containing some columns. I need to remove username and password column when user login and want to show it on admin user login. so user can't able to see usernames and passwords in these column. only admin can see these columns.
I used hidden Config likehidden : true
on user login but user can unhide it using grid's internal tool. So, I want to completely remove these columns from that grid when user get login.
You can see below is my sample ExtJs code. I didn't found any config in sencha/Extjs doc to completely remove these column using condition. Please give me solution on this. how can I do in that way.
Ext.define('fleet.view.Vehiclelist', {
extend: 'Ext.grid.Panel',
initComponent: function () {
Ext.apply(this, {
layout: 'fit',
columns: [{
header: 'Vehicle Id',
dataIndex: 'vehicleId',
flex: 1
}, {
header: 'Vehicle No',
dataIndex: 'vehicleNo',
flex: 1
},{
header: 'Username',
dataIndex: 'username',
flex: 1,
hidden: this.isAdmin == true ? false : true
}, {
header: 'Password',
dataIndex: 'password',
flex: 1,
hidden: this.isAdmin == true ? false : true
}]
});
this.callParent();
}
});
Below image showing when I am login with user, this get hide columns but even user can able to show it by using grid internal tools of show/hide columns.