日期:2014-05-20 浏览次数:20836 次
1. <script type="text/javascript"> 2. Ext.onReady(function(){ 3. var Tree = Ext.tree; 4. 5. var tree = new Ext.tree.TreePanel({ 6. el:'tree-div', 7. autoScroll : true, 8. animate : true, 9. enableDD : true, 10. containerScroll : true, 11. loader : new Tree.TreeLoader({ 12. dataUrl : 'initialize.action' 13. }) 14. }); 15. 16. var root = new Ext.tree.AsyncTreeNode({ 17. text:'ASK123', 18. draggable : false, 19. id:'0000' 20. }); 21. 22. tree.setRootNode(root); 23. 24. tree.render(); 25. 26. root.expand(); 27. }); 28. </script>
# public String execute() throws Exception { # // ... # list = moduleService.findBySjmkm(this.node); # if(list != null && list.size() > 0){ # boolean isFirst = true; # int last = list.size(); # int count = 0; # for (int i = 0; i < list.size(); i++) { # Module m = (Module) list.get(i); # if (count == 0) { # this.setJsonString("[{\"text\" :\"" + m.getMc() + "\" ,\"id\" :\"" + m.getBh() # + "\" ,\"cls\" :\"folder\"} "); # } else if (i == (last - 1)) { # this.setJsonString(this.getJsonString() + ",{\"text\" :\"" + m.getMc() + "\" ,\"id\" :\"" # + m.getBh() + "\" ,\"cls\" :\"folder\"}]"); # } else { # this.setJsonString(this.getJsonString() + ",{\"text\" :\"" + m.getMc() + "\" ,\"id\" :\"" # + m.getBh() + "\" ,\"cls\" :\"folder\"}"); # } # count++; # } # System.out.println(this.getJsonString()); # } # return SUCCESS; # }