OdinaSpb / jstree

Automatically exported from code.google.com/p/jstree
0 stars 0 forks source link

Can't implement Expand/Collapse on folder click #982

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Apply ui mode or various other code bits I've come across
2. Try clicking a folder.

What is the expected output? What do you see instead?

I am attempting to get folders to expand and collapse. No errors, but not able 
to achieve the expand/collapse functionality.

What version of the product are you using? On what browser?

jsTree 1.0-rc3 (with a slight modification to address IE9 issue, see 
http://code.google.com/p/jstree/issues/detail?id=907&colspec=ID%20Type%20Status%
20Priority%20Owner%20Summary)
Any browswer.

Please provide any additional information below.

I am attempting to get my tree to expand/collapse on clicking a folder. I've 
attempted several strategies that seem fairly straight-forward to implement 
this with no success, including using the ui plugin and .bind. No joy. 

I am using the xml_data plugin and am feeding in xml, which I wonder might be a 
hindrance to my attempts but really don't know for sure. My test code follows 
with a more complete file attached. I would be grateful for any direction here. 

Many thinks!!
/jon

        $(function () {
            $("#jstree_lists").jstree({ 

                "themes" : {
                    "theme" : "classic",
                    "dots" : true,
                    "icons" : true
                },    

                "xml_data" : { 

                    "data" : "<root><item id=\"li_4\"><content><name><![CDATA[Folder A]]><\/name><\/content><item id=\"li_4\"><content><name><![CDATA[Folder 1]]><\/name><\/content><item id=\"li_3\"><content><name class=\"leaf_type_pdf\" href=\"#\" onclick=\"launchResource('pdf','','','File A1a.pdf','','test_name','');return false;\"><![CDATA[File A1a]]><\/name><\/content><\/item><item id=\"li_4\"><content><name class=\"leaf_type_pdf\" href=\"#\" onclick=\"launchResource('pdf','','','FileA1b.pdf','','test_name','');return false;\"><![CDATA[FileA1b]]><\/name><\/content><\/item><\/item><\/item><item id=\"li_8\"><content><name><![CDATA[Folder B]]><\/name><\/content><item id=\"li_8\"><content><name><![CDATA[Folder 2]]><\/name><\/content><item id=\"li_7\"><content><name class=\"leaf_type_pdf\" href=\"#\" onclick=\"launchResource('pdf','','','FileB2c.pdf','','test_name','');return false;\"><![CDATA[FileB2c]]><\/name><\/content><\/item><item id=\"li_8\"><content><name class=\"leaf_type_pdf\" href=\"#\" onclick=\"launchResource('pdf','','','FileB2d.pdf','','test_name','');return false;\"><![CDATA[FileB2d]]><\/name><\/content><\/item><\/item><\/item><\/root>",
                    "xsl" : "nest"

                },

                "progressive_render": true, 

                "plugins" : [ "themes", "xml_data"]

            });
        });

Original issue reported on code.google.com by jongrobi...@gmail.com on 22 Aug 2011 at 10:47

Attachments:

GoogleCodeExporter commented 9 years ago
hello, you can add lines to simulate the click on icon
i'm used jquery 

 .delegate("a.categorynode", "click", function (event, data) {
            $(this.parentNode).children(".jstree-icon").click();
});

Original comment by richard....@gmail.com on 3 Nov 2011 at 3:08

GoogleCodeExporter commented 9 years ago
Richard

thanks very much for the reply. I will take a look at that. Much appreciated.

Original comment by jongrobi...@gmail.com on 9 Nov 2011 at 10:08