i believe that maybe a better solution could be to:
1) generate serverside an xml or a json array (this is occupy less
bandwidth) instead of the arraylist...
2) change rootnode to an asynctreenode...
3) associate a TreeLoader (json) or a XMLTreeLoader (xml)
4) set the url on the treeLoader -> treeLoader.setDataUrl(url of the file or
of a servlet responding a json/xml string)
4) call a reload in this way -> personRoot.reload();

i believe this solution is the smartest and simplest....
infact simply calling a reload of the rootNode will connect to server
and update the tree....

bye Pat

PS Sorry for the in-existent .refresh :(
2009/7/23 subbu <[email protected]>

>
> Hi all,
>         There is no TreePanel.refresh() method.How can we reload the
> tree.Please give me a solution.Is there any standard method for
> reloading the tree with out refreshing the page.If we refresh the page
> it will come.The following is my code .
>
>
>
>                final TreePanel personDriverPanel = new TreePanel();
>                personDriverPanel.setBodyStyle("background-
> color:#EEEEEE");
>                personDriverPanel.setCollapsible(true);
>                personDriverPanel.setIconCls("world-icon");
>                personDriverPanel.setAnimate(true);
>                personDriverPanel.setEnableDD(true);
>                personDriverPanel.setContainerScroll(true);
>                personDriverPanel.setAutoScroll(true);
>                personDriverPanel.setRootVisible(true);
>                personDriverPanel.setFrame(true);
>                personDriverPanel.setAutoHeight(true);
>                personDriverPanel.setTitle("Persons/Drivers");
>                personDriverPanel.setWidth(200);
>                personDriverPanel.setHeight(250);
>                personDriverPanel.setId("panleid");
>
>                final TreeNode personRoot = new TreeNode("Persons");
>                personRoot.setId("rootPerson");
>
>                personRoot.addListener(new TreeNodeListenerAdapter()
>                {
>                        public void onDblClick(Node node, EventObject e)
>                        {
>                                GWT.log("Node Row " +
> node.getAttribute("nbr") + " clicked",
> null);
>                                // HOW DO I KNOW IF THE CHECKBOX IS CHECKED
> FROM THIS CODE BLOCK?
>                                personDriverPanel.expandAll();
>                                // window.show();
>                        }
>                });
>
>
>                personDriverPanel.addListener(new TreePanelListenerAdapter()
> {
>                        public void onContextMenu(TreeNode root, EventObject
> e) {
>                                int[] xy = e.getXY();
>                                showPersonDriverMenu(root, e);
>                        }
>                });
>
>
>                greetingService.buildPersonDetails(new
> AsyncCallback<Object>(){
>                        public void onFailure(Throwable caught){
>                                //
>  com.google.gwt.user.client.Window.alert("Fail");
>                        }
>                        @SuppressWarnings("unchecked")
>                        public void onSuccess(Object result) {
>
>                                ArrayList<PersonDriver> a =
> (ArrayList<PersonDriver>) result;
>                                TreeNode parent[] = new TreeNode[a.size()];
>                                for(int i=0;i<a.size();i++)
>                                {
>                                        //System.out.println("Person
> nameddd:"+a.get(i).getPersonName());
>                                        parent[i] = new
> TreeNode(a.get(i).getPersonName());
>                                        parent[i].setExpanded(false);
>                                        parent[i].setAttribute("PersonID",
> "personname");
>
>  parent[i].setId(a.get(i).getPersonId().toString());
>                                        personRoot.appendChild(parent[i]);
>                                }
>
>  //System.out.println("Depth:::"+personRoot.getDepth());
>
>                        }
>                });
>
>                personRoot.setExpanded(true);
>                personDriverPanel.setRootNode(personRoot);
>                personDriverPanel.expandAll();
>
>
>
> Thanks and Regards,
>                              Subash
>
> On Jul 20, 5:46 pm, Patrizio De Michele <[email protected]> wrote:
> > try reloading it....
> > if your root is an asynctreenode call reload....it'll go to server and
> > reload the entire tree...
> > otherwise add a node to the tree and call myTreePanel.refresh()
> >
> > 2009/7/20 subbu <[email protected]>
> >
> >
> >
> > > Hi,
> > >         I had created a tree in gwt ext .I had got values from db and
> > > its showing.Now i want to right click on the root node and add another
> > > entry .Its adding in db but not showing in the tree.Is it possible to
> > > refresh the tree.
> >
> > > thanks and regards,
> > >                            Subash
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to