Export to GitHub

struts2-jquery - issue #553

Support for different Tree Node Types


Posted on Jun 10, 2011 by Swift Lion

http://www.jstree.com/documentation/types

Comment #1

Posted on Jun 10, 2011 by Swift Lion

http://code.google.com/p/struts2-jquery/source/detail?r=1458

Comment #2

Posted on Jun 10, 2011 by Swift Lion

Issue 545 has been merged into this issue.

Comment #3

Posted on Jun 10, 2011 by Swift Lion

Example:

    <s:set id="contextPath"  value="#request.get('javax.servlet.forward.context_path')" />
    <sjt:tree 
        id="treeTypes" 
        jstreetheme="default" 
        openAllOnLoad="true" 
        types="{
                'valid_children' : [ 'root' ],
                'types' : {
                    'root' : {
                        'icon' : { 
                            'image' : '%{contextPath}/images/root.png' 
                        },
                        'valid_children' : [ 'folder', 'file' ],
                    },
                    'folder' : {
                        'icon' : { 
                            'image' : '%{contextPath}/images/folder.png' 
                        },
                        'valid_children' : [ 'folder', 'file' ],
                    },
                    'file' : {
                        'icon' : { 
                            'image' : '%{contextPath}/images/file.png' 
                        },
                        'valid_children' : [ 'none' ],
                    }
            }
    }">
        <sjt:treeItem title="Root" type="root">
            <sjt:treeItem title="Folder One"  type="folder">
                <sjt:treeItem title="File One" type="file"/>
                <sjt:treeItem title="File Two" type="file"/>
            </sjt:treeItem>
            <sjt:treeItem title="Folder Two"  type="folder">
                <sjt:treeItem title="Folder Three"  type="folder">
                    <sjt:treeItem title="File Four" type="file"/>
                </sjt:treeItem>
                <sjt:treeItem title="File Three" type="file"/>
            </sjt:treeItem>
        </sjt:treeItem>
    </sjt:tree>

Comment #4

Posted on Jun 15, 2011 by Happy Lion

This will work with json data ?

Comment #5

Posted on Jun 29, 2011 by Swift Lion

No this is for static trees only. But with JSON based Trees you can control the types in your JSON Action and change the Icon with setIcon.

Status: Fixed

Labels:
Type-Enhancement Priority-Medium Component-Tree-Plugin Milestone-3.1.0