第一种:

直接通过TreePanel中的Config Option中的listener来添加,代码如下:

var TreePan = new Ext.tree.TreePanel({

id: 'TreePan',

title: "侧边栏",

useArrows: true,

width: 240,

height: 660,

region: 'west',

frame: true,

autoScroll: true,

enableDD: false,

containerScroll: true,

draggable: false,

root: root,

rootVisible: false,

collapsible: true,

collapsed: true,

animate: true,

listeners: {

'click': function(node, e) {

if (node.isLeaf()) {

var newWin = new Ext.Window({

width: 745,

height: 529,

title: "现用技术标准",

html: "<iframe src=/"Manage/VolunteerShipInfo.aspx/" marginheight=/"0/" marginwidth=/"0/" width=/"727/" height=/"500/"></iframe>"

});

newWin.show();

}

}

}

失败,表现为程序对 “node.isLeaf()”这个方法的识别有问题,加上这条if语句,则点击所有节点没反应(包括非叶节点);去掉这个if,则点所有节点都会出现新窗口(包括非叶节点)。

第二种:

使用TreePan.on来添加Event,代码如下:

var TreePan = new Ext.tree.TreePanel({

id: 'TreePan',

title: "侧边栏",

useArrows: true,

width: 240,

height: 660,

region: 'west',

frame: true,

autoScroll: true,

enableDD: false,

containerScroll: true,

draggable: false,

root: root,

rootVisible: false,

collapsible: true,

collapsed: true,

animate: true,

}

TreePan.on('click', BiaoZhunClick);

function BiaoZhunClick(node, e) {

if (node.leaf) {

//            e.stopEvent();

var newWin = new Ext.Window({

width: 745,

height: 529,

title: "现用技术标准",

html: "<iframe src=/"Manage/VolunteerShipInfo.aspx/" marginheight=/"0/" marginwidth=/"0/" width=/"727/" height=/"500/"></iframe>"

});

newWin.show();

}

}

失败,表现如方法二。

第三种:

通过查API Document,知道可以用addListener这个方法来给TreePanel添加Event,于是尝试如下:

var TreePan = new Ext.tree.TreePanel({

id: 'TreePan',

title: "侧边栏",

useArrows: true,

width: 240,

height: 660,

region: 'west',

frame: true,

autoScroll: true,

enableDD: false,

containerScroll: true,

draggable: false,

root: root,

rootVisible: false,

collapsible: true,

collapsed: true,

animate: true,

}

TreePan.addListener('click', BiaoZhunClick);

function BiaoZhunClick(node, e) {

if (node.leaf) {

//            e.stopEvent();

var newWin = new Ext.Window({

width: 745,

height: 529,

title: "现用技术标准",

html: "<iframe src=/"Manage/VolunteerShipInfo.aspx/" marginheight=/"0/" marginwidth=/"0/" width=/"727/" height=/"500/"></iframe>"

});

newWin.show();

}

}

成功,终于可以实现只有在点击叶节点时才弹出浮窗了。

转自:http://blog.csdn.net/scythev/article/details/4818610

ExtJS中给Tree节点加click事件的更多相关文章

  1. ExtJs中实现tree节点,全部是单击展开和收缩效果,和收藏夹点击功能一样

    listeners : { click : function(node, c) {// 单击节点事件(node是节点对象) if(!node.isLeaf()){//不是叶子节点 node.singl ...

  2. 33. Extjs中的tree节点的操作

      转自:https://blog.csdn.net/masterShaw/article/details/51354351?utm_source=blogkpcl9 ext 树节点操作   tree ...

  3. 在vue中无论使用router-link 还是 @click事件,发现都没法从列表页点击跳转到内容页去

    在vue中如论使用router-link 还是 @click事件,发现都没法从列表页点击跳转到内容页去,以前都是可以的,想着唯一不同的场景就是因为运用了scroll组件(https://ustbhua ...

  4. vue中,svg图标添加click事件,部分浏览器不生效

    vue项目中,使用svg图标,但是发现,为svg图标绑定click事件时,部分浏览器会出现,点击没有反应的情况,代码如下: <icon name="icon_add" @cl ...

  5. Extjs中创建Tree菜单【一】

    此篇treepanel的描写是很简单,没有太大的难度,在学习时,可以先熟悉tree的一些配置信息.属性.方法和事件. 然后先写一个简单的例子,慢慢了解从中如何实现的,然后在慢慢的深入了解,实现一些复杂 ...

  6. MVC4中EasyUI Tree异步加载JSON数据生成树

      1,首先构造tree接受的格式化数据结构MODEL /// <summary> /// 定义EasyUI树的相关数据,方便控制器生成Json数据进行传递 /// </summar ...

  7. listView中adapter有不同的click事件的简单写法

    在android中,listview一般都是通过一个adapter来绑定数据,一般的item的点击事件都会指向同一个目标(intent),仅仅是所带的參数不同而已.但有的时候事与愿违,每一个item的 ...

  8. jQuery中click事件多次触发解决方案

    jQuery 中元素的click事件中绑定其他元素的click事件. 因为jQuery中的click事件会累计绑定,导致事件注册越来越多. 解决方案: 1.能够避开,避免把click事件绑定到其他元素 ...

  9. [C# 基础知识系列]专题五:当点击按钮时触发Click事件背后发生的事情 (转载)

    当我们在点击窗口中的Button控件VS会帮我们自动生成一些代码,我们只需要在Click方法中写一些自己的代码就可以实现触发Click事件后我们Click方法中代码就会执行,然而我一直有一个疑问的—— ...

随机推荐

  1. Objective的宏到swift中该怎么办?

    ReadMehtml, body {overflow-x: initial !important;}.CodeMirror { height: auto; } .CodeMirror-scroll { ...

  2. (转) Hadoop1.2.1安装

    环境:ubuntu13 使用的用户为普通用户.如:用户ru jdk安装略 1.安装ssh (1) sudo apt-get install openssh-server (2)配置ssh面密码登录 $ ...

  3. linux rsync介绍(八)

    [教程主题]:rsync [1] rsync介绍 Rsync(Remote Synchronize) 是一个远程资料同步工具,可通过LAN/WAN快速同步多台主机,Rsync使用所为的“Rsync演算 ...

  4. js 空数组是true还是false

    var arr = new Array(); // 或 var arr = []; 我们知道,初始化后,即使数组arr中没有元素,也是一个object. typeof arr; // "ob ...

  5. elasticsearch6.4 memory locking requested for elasticsearch process but memory is not locked

    [2018-10-18T05:28:57,713][ERROR][o.e.b.Bootstrap ] [node-45] node validation exception[1] bootstrap ...

  6. git基本操作:上传代码

    利用git将本地代码提交到远程服务器一般分为如下5个步骤: 一.查看当前文件的状态 使用git status命令可以查看有那些文件进行了修改,一般有下面几个状态: 1.Untracked: 未跟踪, ...

  7. 很简单的在Ubuntu系统下安装字体和切换默认字体的方法

    摘要: Ubuntu系统安装好后,默认字体对于中文的支持看上去不太美丽,于是很多朋友可能需要设置系统的默认字体为自己喜欢的字体.本文主要介绍如何解决这两个问题. 说明:测试系统是Ubuntu14.04 ...

  8. Elasticsearch与Solr 选型

    转自:http://blog.csdn.net/jameshadoop/article/details/44905643 搜索引擎选择: Elasticsearch与Solr 搜索引擎选型调研文档 E ...

  9. USB学习笔记连载(十一):CY7C68013A的启动方式-EEPROM

       上述的应用笔记中有介绍FX2LP的启动选项,主要包括I2C启动和USB启动. 说白了I2C启动需要使用外部的EEPROM,USB启动,只是使用上位机控制软件将配置程序FX2LP中,不用EEPRO ...

  10. 【转】Android下使用Properties文件保存程序设置

    原文:http://jerrysun.blog.51cto.com/745955/804789 废话不说,直接上代码.    读取.properties文件中的配置:  String strValue ...