我是jsTree的新手。我有一个简单的Apartement复合树结构,每个复合体内都有子单元。当我双击根节点时,它的子节点正确打开...但它也会触发我指定的单击事件。当我双击节点时,有没有办法阻止点击事件?
我查看了jsTree API并且没有找到关于这种奇怪行为的任何解释。
*********补充资料************************
我发现我的更改没有解决问题。 这是我目前用于jsTree树的相关代码:
// jsTree Container Element
<div id="mainPropertyTree"></div>
// This is a subset of the JSON structure being loaded with the "lclData" variable below
[ {id: 'P1',parent: '#',text: 'Lakeshore @ Preston 3700 Preston Road (P1)',type: 'typeMF',pId: '1',uId: '2'},
{id: 'P2',parent: '#',text: 'Shorecrest Homes (P2)',type: 'typeDpx',pId: '2',uId: '4'},
{id: 'T1',parent: 'U1',text: 'Aristeo Gamino (T1)',type: '',pId: '-1',uId: '-1'},
{id: 'T3',parent: 'U4',text: 'Damara Sampson (T3)',type: '',pId: '-1',uId: '-1'},
{id: 'U1',parent: '#',text: '411 Bonham Drive (U1)',type: 'typeSF',pId: '3',uId: '1'},
{id: 'U2',parent: 'P1',text: '3700 Preston Rd #1111 (U2)',type: 'typeMF',pId: '1',uId: '2'},
{id: 'U4',parent: 'P2',text: '3252 Shorecrest Drive (U4)',type: 'typeDpx',pId: '2',uId: '4'},
{id: 'U5',parent: '#',text: '2525 South Bend Lane East Side (U5)',type: 'typeSF',pId: '4',uId: '5'},
{id: 'U6',parent: '#',text: '500 West Broadway (U6)',type: 'typeSF',pId: '5',uId: '6'},
]
// This is the code inside the JQuery Ajax Success Event Handler
// The "lclData" variable contains the JSON structure from above
$("#mainPropertyTree").jstree({
core:{ data: lclData,
themes: {variant:"large"}
},
plugins: ["wholerow"]
});
// This is the "Click.jstree" event handler
// This gets called even if I double click the node
$("#mainPropertyTree").on("click.jstree", function(e) {
// Display the database record for the nodes selected (parent, grandparent...etc)
if (!e.target.id)
return;
var currId = jsTreeTransId(e.target.id).id; // this just cleans up the node ID
var node = $(this).jstree().get_node( currId );
displayCurrentNode(node);
});
我是jsTree的新手,所以不要假设我的知识:)