jstree 点箭头有效但点后面item无效的bug

比如现在有html(django template)如下:

<li class="jstree-closed">  
<ins class="jstree-icon"> </ins>  
<a href="#" name="template_category_item" value="{{key}}"><ins class="jstree-icon"> </ins>{{key}}</a>  
<ul>  
{% for template in value %}  
<li class="jstree-last jstree-leaf">  
<ins class="jstree-icon"> </ins>  
<a href="#" name="template_list_item" value="{{template.pk}}"><ins class="jstree-icon"> </ins>{{template.module}}</a>  
</li>  
{% endfor %}  
</ul>  
</li>  

  


为了修复这个bug,只要给template_category_item添加一个事件响应即可,代码如下:

$("a[name=template_category_item]").live("click", function(e){  
var evt = document.createEvent("MouseEvents");
evt.initEvent("click", true, true);
$(this).prev()[0].dispatchEvent(evt);
return false;
});




 


posted @ 2011-10-26 22:37  酱油哥  阅读(212)  评论(0编辑  收藏  举报