Topic: Expanding nodes based on initial value of JSON array

Hi moro,

Here's what I am missing.

Structure:

var json=[{
    "property":
    {
        "name": "root"
    },
    "state" :
    {
        "open": true
    },
    "children":
    [
        {
            "property":
            {
                "name": "node1"
            }
        }
    ]
}]


When tree is rendered I want it to expand by default all nodes that have state.open set to true.

Thanks,
T>

Re: Expanding nodes based on initial value of JSON array

moro,

any plans to implement this particular feature?

thx

Re: Expanding nodes based on initial value of JSON array

implemented rev19

Re: Expanding nodes based on initial value of JSON array

moro,

I've been testing this feature in the current version. Unfortunately, it does not quite do what it should.
I think my description of expected behaviour was quite confusing.

Let me try again.

Suppose we have the following tree structure:

+ root
|
+---+ Node1
|     |
|     +---+Node3
|           |
|           +---Node4
|           |
|           +---Node5
|
+---+ Node2

JSON property of Node3 look like:

    "property":
    {
        "name": "Node3"
    },
    "state" :
    {
        "expandto" : true, // This property tells the tree that this node's parents should autoexpand to show this node.
        "open": true // Open node's children Node4 and Node5?
    },
    "children":
    [
        {
           ...
           [Node 4 and Node 5 described]
           ...
        }
    ]

What the tree should do "onLoad" (based on whether `state.expandto` is TRUE) is:

1. Expand Root
2. Expand Node1
3. *Optionally* expand Node3 itself, revealing Node4 and Node5 (read from `state.open`)

What is happening now is: any non-root node that has `state.open` = TRUE is in fact not visible, because all its parents are closed.

I would be extremely nice to have such control over default state of tree nodes.

I hope this is a better explanation & sorry for confusion.

Thanks,
Temuri

Re: Expanding nodes based on initial value of JSON array

temuri wrote:

"expandto" : true, // This property tells the tree that this node's parents should autoexpand to show this node.

This would be very usefull indeed.

Re: Expanding nodes based on initial value of JSON array

implemented expandTo functionality rev29. See docs and demo for more info.