PDA

View Full Version : How to populate list of columns in a grid from database?



jocatastar
2 Dec 2013, 4:15 AM
I am implementing Ext Js grid. And i have some 10 columns to display. But after displaying those 10 columns if some user unselected a column that user does not want to view, at the point i have to save the columns which are in checked state only.

And next time same user lo-gin i have to show the same columns that user wants to view. If user checks on any column only i have to show them.

I have researched and tried with cookie manager but it is buggy it seems. Please suggest me any way to achieve the functionality

Farish
2 Dec 2013, 4:21 AM
you can do an AJAX request to fetch the column states from your database and then when you create the grid, you can use the config hidden and set it to true or false.

Alternatively, after creation of the grid, you can use the hide and show methods:


grid.columns[0].hide();

hides the 1st column in the grid.