自定義樹節點雙擊事件

2022-05-03 06:09:05 字數 1205 閱讀 4604

1

//最後一次觸發節點id

2var lastselectednodeid = null;3

//最後一次觸發時間

4var lastselecttime = null;5

6//在這裡自定義雙擊需要實現的功能

7function

doubliclick(data)

1011

//clicknode單擊事件

12function

clicknode(event, data) 19}

20 lastselectednodeid =data.nodeid;

21 lastselecttime = new

date().gettime();

2223}24

25//

自定義雙擊事件

26function

customdblclickfun() );

31//

節點取消選中時觸發

32 $('#nodeselect').on('nodeunselected', function

(event, data) );35}

3637

//38 $(document).ready(function

() );

自定義雙擊實現的功能

寫好了這個方法之後,發現和原生的單擊方法有衝突,以我用的外掛程式為例,我發現雖然單雙擊功能有衝突,但是在選中的時候背景依舊會變色,於是找到外掛程式的js檔案,以click和selected為關鍵字查詢,打上斷點,除錯,找到單擊的事件

tree.prototype.setselectedstate = function

(node, state, options) ,

this

)); }

//continue selecting node

node.state.selected = true

;

if (!options.silent) , node));}}

else

, node));}}

};

原js檔案裡的單擊事件

在單擊事件裡加上想要實現的單擊功能即可

自定義檔案雙擊開啟事件

自定檔案雙擊開啟事件,需要在登錄檔中註冊檔案的圖示,檔案開啟的啟動軟體路徑。首先,登錄檔中新增描述 圖示 啟動軟體路徑 如下 為操作登錄檔的事件 using system using system.collections.generic using system.text using microso...

雙擊事件無反應和chart自定義datatip

定義雙擊事件無反應 寫好了雙擊事件的解決方法 同事也監聽滑鼠的雙擊事件 但是雙擊的時候還是沒反應 看了乙個帖子說是預設是不支援雙擊事件的 需要把doubleclickenabled屬性設定為true 接下來是 http blog.csdn.net xiang08 archive 2009 04 24...

給自定義控制項新增單擊和雙擊事件

using system using system.collections.generic using system.linq using system.net using system.windows using system.windows.controls using system.windo...