Andv樹元件獲取當前選中的節點

2021-10-09 13:32:01 字數 969 閱讀 5707

antdv 中樹形元件的select事件的兩個引數分別為selectedkeyse,獲取當前選中的節點的方法:

通過事件的e.node.dataref獲取

通過selectedkey獲取

第二種方案如果以記錄的idkey就不得不對樹結構進行展開或者遞迴。解決方案為:在組裝樹的時候生成路徑來作為key

路徑id陣列轉json工具方法(需配置jackson將long序列化string):

private string pathidstojsonarray

(list

pathids)

catch

(jsonprocessingexception e)

return pathidjsonarray;

}

組裝成樹:

public list

getcategorytreelist()

).collect

(collectors.

tolist()

);}private

void

combinetotree

(category root, list

rootpathids, list

nodes)).

collect

(collectors.

tolist()

);root.

setchildren

(children)

;}

元件(單選):

easyui獲取當前選中的tabs

tabs find iframe tabs header ul li index tabs selected 1 id contents find search button click 這句 獲取easyui當前選中的tabs並觸發類為 search button 的點選事件 tabs find ...

獲取gridview當前選中行的內容

方法一 selectedindex 獲取gridview當前選中行的內容 txtid.text gridview1.rows gridview1.selectedindex cells 1 text 獲取第二列 txttitle.text ctype gridview1.rows gridview1...

Touchmove獲取當前觸控的Dom節點

這邊通過需求分析,很容易聯想到,使用touchstart和touchmove這兩個方法來處理響應操作,touchstart比較簡單就不說了,監聽touchmove事件時,發現乙個問題,當我無論如何在監聽元素上移動我的手指,所返回的event.touches 0 target永遠指向第乙個觸控元素的e...