I am trying to use the javascript library Fancytree to generate a tree of 
an organization hierarchy.
I manage to load the data in the tree to the first level of the 
organization with a JSON result dictionary. So I have a tree already.

The rest of the children nodes I only want to load if someone clicks a node 
(lazy loading with AJAX call)

<script type="text/javascript">
 var treeData = [
 {{=result}}
 ];


 $(function(){
 $("#tree1").fancytree({
 checkbox: true,
 selectMode: 1,
 source: treeData2 ,
 lazyload: function(e, data){
 var node = data.node;
 data.result = {url: "ajaxtree", data: {mode: "children", parent: node.key}, 
cache: false };
 }
 }); });
</script>

I wrote a controller function ajaxtree that  returns the children as a 
result in JSON format.

I have tried a lot of different ways to accomplish this, but nothing seems 
to work. 
This is the error I get: 

Load error! (SyntaxError: Unexpected token t)

the unexpected token seems to be the first letter of the JSON string with 
the children [{title: "child something" etc.

Anybody an idea or experience with this function? 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to