views:

42

answers:

1

using jstree, i use the next code to Trigger click , but , i can not see the defalut click event, like : the blue background when i click ,

this is my code :

<div id="wrap">
    <div id="header">header</div>
    <div id="main">
        <div id="demo1" style="float:left;width:50%;">
            <ul>
                <li>
                    <a id='a' href="">aaa</a>
                    <!-- UL node only needed for children - omit if there are no children -->
                    <ul>
                        <li><a id="a_1" href="#"> bbb</a></li>
                        <li><a id="a_2" href="#"> ccc</a></li>
                    </ul>
                </li>
            </ul>

        </div>
        <div id="content">www</div>
    </div>
</div>

<div id="footer">
    footer
</div>
<script type="text/javascript">
    $(function () {
    $("#demo1").jstree({
        "themes": {
        "theme": "default",
        "dots": true,
        "icons": true,
        "url": "themes/default/style.css"
      },

        "plugins" : [ "themes", "html_data" ]
    });
    $('#a_1').click(function(){
            $('#content').html('bbb \'s content')
            //return false;
        })
    $('#a_2').click(function(){
            $('#content').html('ccc \'s content')
            //return false;
        })
});
</script>

i find some code like this :

.bind("create.jstree", function (e, data) {
            alert(data)
        })

its mean is : alert data when someone cerate a new file ,

so

does jstree has a method like "click.jstree" ?

thanks

A: 

What you have is fine on the events side, you're just missing a plugin...in the new 1.0 model the ui bits are a separate plugin, if you just change your plugins from this:

"plugins" : [ "themes", "html_data" ]

To this:

"plugins" : [ "themes", "html_data", "ui" ]

You'll get the current node selection coloring, you can give it a try here.

Nick Craver