Hi sam,
I found two way for doing this frst you can use an AsyncTreeLoader that will
call a specified url when you click on the little plus that extends a node.
In my case, as i didn't wanted the whole tree to be presented to the user, I
found another way for doing this:
1°) extended the TreePanel class,
2°) added a store to that class and on the store added the onLoad listener
like this
store.addStoreListener(new StoreListenerAdapter(){
@Override
public void onLoad(Store store, Record[] records) {
Node[] nodes = getRootNode().getChildNodes();
for (int i = 0; i < nodes.length; ++i) {
nodes[i].remove();
}
for (int i = 0; i < records.length; ++i) {
TreeNode node = new
TreeNode(records[i].getAsString("name"));
getRootNode().appendChild(node);
}
getRootNode().expand(true, false);
}
});
3°) add a getter for the store so that my class is usable "like" the
GridPanel
3°) In the client class all i do is
myTree.getStore().loadJsonData(jsonString, false);
It is not neccessary the better solution but it is the one that i am using
and its working fine for me
Regards
Nicolas
PS : sorry for my english but is not my native language
On Mon, Oct 20, 2008 at 2:29 PM, Sam <[EMAIL PROTECTED]> wrote:
>
> Hi all
> I have started exploring get-ext recently and came across sevelral
> examples of tree . However all of them uses the XML data. I want to
> take the data from the database , construct JSON string out of it and
> use it to render the data inside tree. Can anybody please tell me the
> way to achive this functionality.
> Thanks
> Samir
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---