PDA

View Full Version : GridPanel switch "views"



uncoloured
19 Nov 2011, 6:58 PM
Hello all,

I'm currently developing my first real Ext JS application and trying to do it "the MVC way"...

The main UI element of the application is a GridPanel with lots of columns and rows. The users are divided into several groups, and each group is interested in seeing different data in the grid.

So let's say the grid consists of 10 columns. Users belonging to group1 are only interested in col1 and col2, while users in group2 are only interested in col3 and col4. Group3 wants all the columns.

I've been trying to figure out how to implement this without any success. In essence, I'd want to be able to do something like: switchUserView('group1'); which would hide all columns in the grid but col1 and col2.

I tried theGrid.columns[3].hide(); etc but it won't work since col3 can be anything depending on whether the user has moved the columns around. I've also tried moving everything from the grid's column-definition into separate objects (one for each user-group/scenario), and then "loading" it with theGrid.reconfigure(null, userGroupColumns[1]); which actually works - but the column filters function won't work (and it's pretty slow).

Your help is very much appreciated! Thanks.

mitchellsimoens
20 Nov 2011, 12:15 PM
So depending on what group the user logged in belongs to you want to show the appropriate columns?