Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXT JS 4 Create dynamic grid, columns decided at runtime

Tags:

json

ajax

extjs4

I am using EXTJS4. I have a tree which displays classes (classname) on one side. On clicking the class names, I want to be able to display the objects belonging to that class in a separate Grid. The objects will be fetched from the server using ajax and json format. The problem is each class has different number of attributes(columns) so I cannot decide the columns statically. How can I create the grid columns dynamically for each class ? The number of columns will first need to be got from the server.

Thanks

like image 292
Hemlata Avatar asked Feb 06 '26 18:02

Hemlata


1 Answers

Absolutely no problem. You don't have to specify everything in the code. ExtJs 4.0 grid has a method reconfigure which you can use to change store/columns for existing grid. Take a look here: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.Panel-method-reconfigure

like image 174
sha Avatar answered Feb 08 '26 07:02

sha