/*创建对象树*/createTree.js页面define(["dojo/aspect", "dijit/registry", "dijit/tree/ObjectStoreModel", "dijit/Tree", "dojo/store/Memory", "dojo/store/Observable", "dojo/request", "dojo/domReady!"], function(aspect, registry, ObjectSt
/*创建对象树*/ createTree.js页面 define(["dojo/aspect", "dijit/registry", "dijit/tree/ObjectStoreModel", "dijit/Tree", "dojo/store/Memory", "dojo/store/Observable", "dojo/request", "dojo/domReady!" ], function(aspect, registry, ObjectStoreModel, Tree, Memory, Observable, request) { var treeDataStore = new Memory({ data : [{id : "mainTreeId", name : "类别"}], getChildren: function(obj) { return this.query({parent: obj.id}); } }); aspect.around(treeDataStore, "put", function(originalPut){ return function(obj, options){ if(options && options.parent){ obj.parent = options.parent.id; } return originalPut.call(treeDataStore, obj, options); }; }); treeDataStore = new Observable(treeDataStore); var treeStoreModel = new ObjectStoreModel({ store: treeDataStore, query: {id: "mainTreeId"}, labelAttr: "name", labelType: "html" }); var myTree= new Tree({ id: "myTree", model: treeStoreModel }, "transformTree"); transformTree.startup(); }); //增加、删除、修改树节点信息窗口 operateTree.js页面 //增加子节点 treeDataStore.add({id : "Id", name : "Name", parent: "mainTreeId"}); //删除选中的树节点 treeDataStore.remove(selectedItem.id); //修改树中的转换name var stores =(registry.byId("myTree").model.store); var storeObj=stores.get(registry.byId("myTree").selectedItem.id.toString()); storeObj.name = "newName"; stores.put(storeObj);