1
下面的代码设置了我的树(s:property
标签struts2的东西):jstree:左/中鼠标区分点击
$(function() {
$("#networkTree").jstree({
"json_data" : {
"ajax" : {
"url" : "<s:property value='networkTreeDataUrl'/>"
}
},
"plugins" : [ "themes", "json_data", "ui" ],
"themes" : {
"theme" : "default",
"dots" : true,
"icons" : false
},
"core" : {
"html_titles" : true
}
}).bind("select_node.jstree", function (event, data) {
window.location.href = "<s:property value='companyDetailsUrl'/>" + "?companyId=" + data.rslt.obj.attr("id");
})
});
当用户左点击取决于窗口的URL变化的树项目companyDetailsUrl。到目前为止正确,但我希望浏览器(铬)打开链接在一个新的标签,当我点击中间的鼠标按钮照常。看起来任何鼠标点击选择树节点,这触发了替代window.location的绑定事件。什么是防止这种情况的最好方法?