Jared
Jared

Reputation: 4615

Group columns in ExtJS Grid

I am new to ExtJS and cannot seem to figure out how to group columns with its own header. An example of what I'm trying to accomplish is below:

+-----------------------+-----------------------+
|        Group 1        |        Group 2        |
+-------+-------+-------+-------+-------+-------+
| col1  | col2  | col3  | col4  | col5  | col6  |
+-------+-------+-------+-------+-------+-------+
|                                               |
|                 data goes here                |
|                                               |
+-----------------------------------------------+

Obviously, by default I can get col1 through col6 as they are the standard columns. However, I want to add the group names above them. How would I go about doing this or is there a resource that already shows how to do this? I have searched Google for about an hour with no prevail. Thanks in advance for your help!

Upvotes: 1

Views: 5632

Answers (2)

Rob Boerman
Rob Boerman

Reputation: 2168

Like Jared said the pivot grid is great if you want ExtJS to do the pivoting for you. You feed the pivot grid a list of records, specify what to group on on the y and x axis and voila.

I think that would work up to a couple of hundred rows but will become problematic with more ( I have done pivot tables in a online research application I wrote in ExtJS with pivoting on millions of records). Also if you want to feed it your entire grouped data yourself you don't want the pivot grid ( I think)

For both cases you need the GroupHeader plugin:

http://www.sencha.com/forum/showthread.php?22337-Ext.ux.plugins.GroupHeaderGrid-(v1.3)

Good luck with any 1 you choose, both are great

Rob

Upvotes: 4

Keylan
Keylan

Reputation: 325

It looks like you are looking for the pivot grid:

http://dev.sencha.com/deploy/dev/examples/pivotgrid/simple.html

Upvotes: 1

Related Questions