var scrollHeight = container.scrollTop() + nodeOffsetHeight - containerH + 30
container.scrollTop(scrollHeight)
}
}
}
})
/**
* 展示搜索匹配的节点
*/
function showMatchedNode(jqTree, tree, node) {
//展示所有父节点
$(node.target).show()
$(".tree-title", node.target).addClass("tree-node-targeted")
var pNode = node
while ((pNode = tree.getParent(jqTree, pNode.target))) {
$(pNode.target).show()
}
//展开到该节点
tree.expandTo(jqTree, node.target)
//如果是非叶子节点,需折叠该节点的所有子节点
if (!tree.isLeaf(jqTree, node.target)) {
tree.collapse(jqTree, node.target)
}
}
/**
* 判断searchText是否与targetText匹配
* param searchText 检索的文本
* param targetText 目标文本
* return true-检索的文本与目标文本匹配;否则为false.
*/
function isMatch(searchText, targetText) {
return $.trim(targetText)!="" &&targetText.indexOf(searchText)!=-1
}
/**
* 获取easyui tree的所有node节点
*/
function getAllNodes(jqTree, tree) {
var allNodeList = jqTree.data("allNodeList")
if (!allNodeList) {
var roots = tree.getRoots(jqTree)
allNodeList = getChildNodeList(jqTree, tree, roots)
jqTree.data("allNodeList", allNodeList)
}
return allNodeList
}
/**
* 定义获取easyui tree的子节点的递归算法
*/
function getChildNodeList(jqTree, tree, nodes) {
var childNodeList = []
if (nodes &&nodes.length>0) {
var node = null
for (var i=0i
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)