Topic: node icons + json on the fly ?

Hello,

How can I handle custom icons  on the fly with JSON ?
I know that can use style property but I must setup all styles before on tree init.

What I want to do is affect an icon to a node on the fly ...

Re: node icons + json on the fly ?

you can create classes reflects icons, and add their:

[    
    {
        "property": {
            "name": "root",
            "openIcon": "open_icon_class",
            "closeIcon": "close_icon_class"
        },
        "children": [
            {
                "property": {
                    "name": "node1",
                    "openIcon": "another_open_icon_class",
                    "closeIcon": "another_close_icon_class"
                }
            }
        ]
    }
]

or create types with openIcon and closeIcon properties and use their

Re: node icons + json on the fly ?

Does it exists a way to just specify  the image file ?
Beacause with this method I must have defined CSS styles before ...

Last edited by scramatte (2008-12-15 00:14:22)

Re: node icons + json on the fly ?

scramatte wrote:

Does it exists a way to just specify  the image file ?

no

Re: node icons + json on the fly ?

what happens is that without this feature is complicate to handle  icons on the fly with JSON.
Because is not easy to create CSS style with javascript ...

Re: node icons + json on the fly ?

I've found these snippets to create CSS using javascript

http://webdevel.blogspot.com/2006/06/cr … cript.html
http://www.webscriptexpert.com/Javascri … avascript/

Last edited by scramatte (2008-12-15 10:40:51)