2010-08-23 138 views
2

使用jstree,我使用下一个代码来触发点击,但是,我看不到defalut点击事件,如:我点击时的蓝色背景,如何触发点击事件没有明确的默认点击事件jstree

这是我的代码:

<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> 

我觉得像这样的代码:

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

它的意思是:警报数据,当有人创造学习一个新的文件,

so

jstree是否有像“click.jstree”这样的方法?

感谢

回答

0

你有什么是事件侧细线,你只是缺少一个插件......在新的1.0模式的UI位是一个单独的插件,如果你只是改变你的插件从这个:

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

要这样:

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

你会得到当前的节点选择着色,you can give it a try here