FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 4948|回复: 8
打印 上一主题 下一主题

自己动手,tree增加右键菜单

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-4 04:39:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<script type="text/javascript">
                         function onReady() {
                             var treeClientID = '<%= DeviceTree.ClientID %>';//树的id
                             var tree = X(treeClientID);
                             tree.on("contextmenu", function (node, e) {
                                 //node.select();
                                 //alert(node.id);
                                 e.preventDefault();
                                 var treeMenu = new Ext.menu.Menu
                                    ([
                                        { cls: "x-btn-text-icon", text: "展开", icon: "./res.axd?icon=webcam.png", pressed: true, handler: function () { node.expand(true, false) } },
                                        { cls: "x-btn-text-icon", text: "收缩", icon: "./res.axd?icon=webcam.png", pressed: true, handler: function () { node.collapse(true, true) } },
                                        { cls: "x-btn-text-icon", text: "添加", icon: "./res.axd?icon=webcam.png", pressed: true },
                                        { cls: "x-btn-text-icon", text: "上移", icon: "./res.axd?icon=webcam.png", pressed: true },
                                        { cls: "x-btn-text-icon", text: "下移", icon: "./res.axd?icon=webcam.png", pressed: true },
                                        { cls: "x-btn-text-icon", text: "删除", icon: "./res.axd?icon=webcam.png", pressed: true }

                                    ]);
                                 //定位菜单的显示位置
                                 treeMenu.showAt(e.getPoint());
                             });

                         }
                    </script>
沙发
发表于 2012-12-6 07:58:47 | 只看该作者
有没有更加详细点的资料,点击事件说明一下怎么做?
板凳
 楼主| 发表于 2012-12-6 23:56:51 | 只看该作者
handler: function () { node.expand(true, false) }
里面是点击处理的事件函数
地板
发表于 2013-8-14 11:49:22 | 只看该作者
不错,这个还真有些用
6#
发表于 2013-8-30 15:24:14 | 只看该作者
不错,这个还真有些用
8#
发表于 2014-2-27 10:45:31 | 只看该作者
好东西,以后用的上,谢谢啦
9#
发表于 2014-2-27 14:15:53 | 只看该作者
呵呵,不错。
最好能把独立运行的小项目传上来以供大家学习参考。
谢谢哈
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-5-10 14:44 , Processed in 0.047003 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表