English 中文(简体)
How to add nodes to a dijit tree on the fly
原标题:

Basically what I have is a tree with 3 nodes, created like so:

        for (var i=0; i<response.length; i++) {
            response[i]["type"] = "project";
        }

        var data = {
            "identifier": "name",
            "label": "name",
            "items": response
        };

        var store = new dojo.data.ItemFileReadStore({data: data});
        console.log(store);

        var treeModel = new dijit.tree.ForestStoreModel({
            store: store,
            query: {
                "type": "project"
            },
            rootId: "root",
            rootLabel: "Projects",
            childrenAttrs: ["project"]
        });

        return new dijit.Tree({
            model: treeModel
        },
        "filetree");

Now what I need to do is, when a user clicks on a node, I will make a call to the server to get some more data, and then add some children to said node. From what I have read, I have to update my data store to update the tree ... but I can t figure this out. Some help is appreciated.

问题回答

暂无回答




相关问题
Alpha Beta Searching and Transposition Tables

I have alpha beta search working and want to implement transposition tables to make it faster. The problem I m having is the relationship between the entries in the table and the current position ...

Objects that represent trees [closed]

Are there any objects in C# (or in .net) that represents a binary tree (or for curiosity) and n-ary tree? I am not talking about presentation tree controls, but as model objects. If not, are there ...

Data structure to sync a file-tree

I m in the process of a writing an application, which needs to synchronize a file-structure between a client and a (http) server. The file-structure is essentially a list of file-paths where each ...

draw dependency graph for a java class

Heyho, I m searching for a tool like JDepend to draw a graph for a java classfile. JDepend seams to be fine, but it s not resolving the deps from the deps (maybe I m just missing some special options?)...

Nested join on same table (tree structure)

My date is organized in tree structure. The following applies (Oracle SQL syntax): CREATE TABLE TREE ( NAME VARCHAR2(20), ID NUMBER(10, 0), PARENT NUMBER(10, 0) ) ; INSERT INTO "TREE" (NAME, ...

sql query tree like structure

I have a tree like structure of Categories, the leaf Nodes in the tree have Products and the products have Cods I need to select all the top level Categories (parent=null) that have leafs (Cods) that ...

xsl loop to split a fragment tree every n times

This is a sample of my XML, it can possibly have thousands of rows of items in a range of categories. <store> <products type="computer"> <item desc="text" amount="99"></c&...

Family Tree in Silverlight

Hello Currently I am working on a project in which I have to create family tree. It will have almostn number of hierarchy. Whole tree should be displayed to user as well as zoom in zoom out facility ...

热门标签