Hejsan,
I am building dynamic Tree Widget. First Level I done with no problem
so it look like:

+ Atletics
+ Ice Hockey
+ Chess
+ Footbal
+ Golf

Functionality must be like when you click on sport must roll up/show
off list of countries like:

+ Atletics
+ Ice Hockey
    + Canada
    + USA
    + Russia
+ Chess
+ Footbal
+ Golf

and when click to some country then show off League like

+ Atletics
+ Ice Hockey
    + Canada
       + Tournaments
       + Extra league
       + 1.league
       + 2.league
    + USA
    + Russia
+ Chess
+ Footbal
+ Golf


PROBLEM is that I need get level of selected TreeItem to for each
different level will fire up different query so for example for
selected  Ice Hockey need get information that it's 1 level of tree so
use databases select to find out all countries for "Ice hockey".
When click to "Canada" TreeItem, it's level 2 I call select to find
out all leagues level for "Canada".

I create handler for Tree like:
// Add a handler that automatically generates some children
                statTree.addOpenHandler(new OpenHandler<TreeItem>() {

                        public void onOpen(OpenEvent<TreeItem> event) {
                                // tree item that was clicked
                                TreeItem itemSelected = event.getTarget();

                                if (itemSelected.getChildCount() == 1) {
                                        // Close item immediately
                                        itemSelected.setState(false, false);

                                        // Add a random number of children to 
the item
                                        String itemText = 
itemSelected.getText();

                                        // request to database according 
selected tree item level

                                        // dummy data
                                        for (int i = 0; i < numChildren; i++) {
                                                // tree item to be added
                                                TreeItem childDescendant = 
itemSelected
                                                                
.addItem(itemText + "." + i);
                                                
System.out.println("\ncildDescendant index: "
                                                                + 
itemSelected.getChildIndex(childDescendant));
                                                childDescendant.addItem("");
                                        }

                                        // Remove the temporary item when we 
finish loading
                                        itemSelected.getChild(0).remove();

                                        // Reopen the item
                                        itemSelected.setState(true, false);
                                }
                        }
                });

Please help me some one I'll do appreciate it.
Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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/google-web-toolkit?hl=en.

Reply via email to