PDA

View Full Version : How to load ChildNodes from database



19 Mar 2015, 10:39 PM
I have 2 columns table column like Product Name ,Product description , I can displaying 1st columns values as Parent Nodes now I would like to Show 2nd Column as Child Node each parent Node .Example :Root ->Sony ->Sony Desc ->Nokia ->Nokia Desc I am using ExtJS Treepanel , SpringMVC with Oracle Database please let me know how could I show Child Nodes ?

Gary Schlosberg
2 Apr 2015, 5:22 AM
I'm having trouble understanding your request. Can you explain a bit more about what you are trying to accomplish? Have you seen the tree examples in the docs?
http://dev.sencha.com/deploy/ext-3.4.0/examples/#sample-8

8 Apr 2015, 6:54 AM
Hey Gary Thanks for replied me . I would like to popup treepanel based on database table column1 as a Parent Node and Column2 as a Child Node using server side spring mvc?

My Table like
Column -1(Item) Column-2(Desc)
Sony Sony Desc
Lenovo Lenovo Desc
Iphone Iphone Desc


//Server Side Spring MVC
My TreeNode Java Class variables are
int id , String text , String item ,String Desc ,Boolean leaf =false, List<TreeNode> child ;
//getter and Setter

@RequestMapping(value="/.getExport")
protected @RespnseBody getExport(){
//Here I am writing list Tree Node but Child node I cannot get it ?
List<TreeNode> list = new ArrayList<TreeNode>();
List<TreeNode> listItem = treeNodeService.getAll();
for(TreeNode treenode:listItem){

//here I would like to add Child Node how could I add each Column1 Parent Item column as Child Desc Column2 could you please let me know or any mistaken made let me know ?

}