JsTree 树视图中的链接不起作用
Links inside JsTree treeview not working
我有一个树视图,其中的表位于最低节点。表格中有某些 links,但 links 不重定向到他们应该的页面。 link 地址在浏览器底部可见,但是 link 没有调用它们应该调用的 ActionMethod(它们根本没有调用它们)。
who 树有很多数据,所以我发布了一个简短的例子来说明大树的外观。
<div id="tree">
<ul>
<li>item1</li>
<li>item2
<ul>
<li>inner item1
<table>
<tr>
<th>Hello</th>
<th><a href="~/Views/home/ActivatePage">link</a></th>
</tr>
<tr>
<th>Hello</th>
<th><a href="~/Views/home/ActivatePage">link</a></th>
</tr>
</table>
</li>
<li>aa</li>
</ul>
</li>
<li>item3</li>
</ul>
知道为什么会发生这种情况,因为当我将 link 粘贴到浏览器字段时它们会起作用。
jstree select_node 防止导航。试试这个
$('body').on('click','a',function(){
window.location=$(this).attr('href');
});
或
$('#tree').on('click','a',function(){
window.location=$(this).attr('href');
});
我有一个树视图,其中的表位于最低节点。表格中有某些 links,但 links 不重定向到他们应该的页面。 link 地址在浏览器底部可见,但是 link 没有调用它们应该调用的 ActionMethod(它们根本没有调用它们)。 who 树有很多数据,所以我发布了一个简短的例子来说明大树的外观。
<div id="tree">
<ul>
<li>item1</li>
<li>item2
<ul>
<li>inner item1
<table>
<tr>
<th>Hello</th>
<th><a href="~/Views/home/ActivatePage">link</a></th>
</tr>
<tr>
<th>Hello</th>
<th><a href="~/Views/home/ActivatePage">link</a></th>
</tr>
</table>
</li>
<li>aa</li>
</ul>
</li>
<li>item3</li>
</ul>
知道为什么会发生这种情况,因为当我将 link 粘贴到浏览器字段时它们会起作用。
jstree select_node 防止导航。试试这个
$('body').on('click','a',function(){
window.location=$(this).attr('href');
});
或
$('#tree').on('click','a',function(){
window.location=$(this).attr('href');
});