PDA

View Full Version : Iterative Hierarchy gridpanel



symbian11
18 Apr 2013, 5:11 AM
Hi,

I have a DB table that looks like this:

id name idparent
1 cat1 null
2 cat2 null
3 subcat1 1
4 subcat2 1
5 subcat3 2

How can I display this hierarchy type in a grid panel that it looks like this:

cat1
---subcat1
---subcat2
cat2
---subcat3

regards, Chris

slemmon
19 Apr 2013, 3:58 PM
I believe what you're interested in is the grid grouping feature:
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.feature.Grouping

There's an example at the top of the API docs page there as well.

symbian11
21 Apr 2013, 9:35 AM
thanks for the reply.

I already had a look at the grouping function.
However, it seems that it does not support multiple levels. (groupbycategory, group again by subcategory,...)

The only way I could think of is to use php to create treepanel nodes directly from the DB. but this is not really convenient. Any other suggestions?

regards, Chris

slemmon
22 Apr 2013, 8:09 AM
I see. You might also check out these user extensions for multi-level grouping:
http://www.sencha.com/forum/showthread.php?226739 (http://www.sencha.com/forum/showthread.php?226739)
http://www.sencha.com/forum/showthread.php?242633 (http://www.sencha.com/forum/showthread.php?242633)