gpt4 book ai didi

java - 右键单击 TreeView 的项目时显示菜单

转载 作者:行者123 更新时间:2023-11-30 18:27:44 25 4
gpt4 key购买 nike

我有一个 TreeView ,我想为不同的项目添加右键单击支持。我是这样做的:

http://jsfiddle.net/doonot/xWjSz/

菜单仅显示第一个根模块(右键单击后),但不显示其余根模块。你能告诉我我必须更改什么才能获得所有根模块的菜单吗?

非常感谢,非常感谢您的回答。

最佳答案

Hiya 请看这个演示 http://jsfiddle.net/hYJPv/1/ http://jsfiddle.net/hYJPv/ (修复了问题) diff approach here http://jsfiddle.net/UeqBk/for_Dooonot_from_Tats_innit/

右键单击 时,您会收到警报。

代码

$(document).ready(function()
{
// If you want to disable showing the context menu when right clicking
// on the document, the code below would do the trick.
$(document).bind("contextmenu",function(e)
{
alert('right click capture');
return false;
});

var $tree = $("#tree").kendoTreeView(
{
select: function (event)
{
var $item = $(event.node);
console.log( $item );
alert( "selected" );
}
});


// Find the item you want to select...
var $selected = $('#selected');
var $treePath = $selected.parentsUntil($tree, "li");

var treeView = $tree.data('kendoTreeView');

// Expand the tree in order to show the selected item
treeView.expand( $treePath );

// Gotta make both calls...
treeView.select( $selected );
treeView.trigger( 'select', {node: $selected} );
});

关于java - 右键单击 TreeView 的项目时显示菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10413033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com