PDA

View Full Version : Tree with Grid in nodes - combine widgets



zoja
8 Sep 2010, 12:55 AM
I'm looking for a solution on how to combine two widgets. I'm taling about the Tree widget and the Grid widget in such way that f.e. every node of tree represents a database table and after expanding it shows record in a grid widget. Is there a way to combine those two in one ?

Condor
8 Sep 2010, 1:10 AM
Would a TreeGrid or a grouped grid work?

zoja
8 Sep 2010, 1:17 AM
not really because the TreeGrid has defined columns and even if dynamically changed i would have to close one node before opening the other (because the grids would be different in each of these nodes)

Condor
8 Sep 2010, 1:26 AM
You mean different columns for each grid?

Would an accordion layout of gridpanels work?

zoja
8 Sep 2010, 1:34 AM
The thing is i need to have a tree with expanding nodes containing Grids. It is exactly as if the Nodes represented database tables and there would be Records of the expandend node(table) in the grid. So the columns would be different in every grid

Condor
8 Sep 2010, 1:40 AM
To make a treepanel behave that way you would have to extend TreeNodeUI to render a gridpanel inside the tree node. Don't forget to also destroy the grid if the node is destroyed, otherwise you leak memory.

zoja
8 Sep 2010, 1:53 AM
Can you give some examples of such extending the TreeNodeUI ? Thanks for the help :)

Condor
8 Sep 2010, 1:56 AM
You could have a look at the ColumnNodeUI class from the examples (you need to write a renderElements method).