日期:2014-05-16 浏览次数:20688 次
this.createAssignDataPanel = function() { var formPanel = new Ext.form.FormPanel({ id : 'formPanelAssignData', renderTo : 'viewWindow', frame : true, labelWidth : 70, labelAlign : 'right', layout : "anchor", items : [{ xtype : "hidden", name : "role.id" },{ id : "treePanel", xtype : 'treepanel', rootVisible : false, autoScroll : true, animate : false, enableDD : false, anchor:'0 0', containerScroll : true, root : new Ext.tree.AsyncTreeNode({ id : "org_1", text : "全部通道", expand : true, loader : new Ext.tree.TreeLoader({ url: 'roleRelaTreeCreateServlet?', preloadChildren:true, baseAttrs:{ uiProvider:Ext.tree.TriStateNodeUI }, listeners : { 'beforeload' : function(loader, node) { if(node.attributes.type == 2){//前端设备 loader.url = "roleRelaTreeCreateServlet?"; loader.baseParams = {'role.id':this.grid.getSelectionModel().getSelected().get(this.primaryKey)}; }else{ loader.url = "roleRelaTreeCreateServlet?"; loader.baseParams = {'org.id': this.getNodeId(node),'role.id':1}; } }, scope:this} }) }) }] }); return formPanel; };
在servelt中用response.getWriter().print("{id:aaa,text:'te',leaf:true/false,children:...}"); 这里的格式是固定的
------解决方案--------------------
把组合好的json输出到页面就行了
如4楼所示
其中输出的json字符串id和text属性不能少 其它属性按照需要增删