extjs 中如何操作tree的节点

2025-05-11 03:49:36
推荐回答(1个)
回答1:

使用tree的以下方法:
on( String eventName, Function handler, Object scope, Object options )
为该元素添加事件处理函数(addListener的简写方式)。Appe...
为该元素添加事件处理函数(addListener的简写方式)。Appends an event handler to this element (shorthand for addListener)
参数项:
eventName : String
事件名称The type of event to listen for
handler : Function
处理函数The method the event invokes
scope : Object
(可选的) 执行处理函数的作用域。“this”对象指针(optional) The scope in which to execute the handler function. The handler function's "this" context.
options : Object
(可选的)(optional)
extjs的eventName基本上继承了HTML元素的标准事件,如mouseover、 mousedown、click、blur、focus、change等。同时新增了fired跟quit两个事件。

简单代码如下:
fnname1 = function(){

alert("点击事件");
}

fnname2 = function(){

alert("移动事件");
}
treename.on(

{

click:fnname1,

mouseover:fnname2

})

还可以通过继承增加自定义的事件,这里不多作介绍。