How to return the selected item on a dinamically builded treepanel ??

I have an issue trying to get the selected item of my treepanel, which is filled from a treestore by ajax. When I try treepanel = Ext.getCmp('tree').getSelectionModel().getSelection() it returns [] also with getSelected() returns [] and is basically the same with all methods I use to get the selected child., the node childs are inside the root node which is hidden, here is my treepanel code: