View Full Version : ExtJS Autogenerate columns

5 Sep 2012, 12:02 AM

I'm new to ExtJS and NOT sure if we can auto generate columns in ExtJS 4.1 grid.Panel.

Please let me know if there is any way through which we can auto generate columns and load data in grid without using Model.

5 Sep 2012, 12:48 PM
Have a look at:


5 Sep 2012, 7:34 PM
Thanks Scott. I'm using diffrent approach for the implementation.

I have used menu control which has various filter options. Based on menu selection; I'm giving AJAX call to filter data and rebinding the grid (...store reload)

Menu control has option to set number of columns needs to display in grid.Panel. I tried to hide columns of grid.Panel somehow there is no luck. We have property hidden: true/ false while creating grid.Panel and next time we are just changing url of store to load data and reload store object which takes care of rebinding grid with new data.

In my case I have to display list of the months like 'January', 'February','March', ... etc and user has option to select how much months data he want to see so the list of the months are required columns in grid.Panel.

Could you please let me know how should I show/ hide grid.Panels columns whenver use change number of required columns from Menu control?

5 Sep 2012, 9:08 PM
I'm calling following method to rebind grid from menu click handler-

function filterGrid(monthCnt) {
//Load data based on fiter criteria
var Url = "AJAXPages/AjaxPerson.aspx?monthCnt=" + monthCnt;
store.proxy.url = Url;

menu = Ext.create('Ext.menu.Menu', {
width: 100,
margin: '0 0 10 0',
floating: false,
items: [{
text: 'Month Count',
handler: function (menu, ctl) {
//Ext.getCmp("gridid").columns[1].hidden = true;