How to use showNodes method in wpt

Best JavaScript code snippet using wpt

ztreeSearch.js

Source:ztreeSearch.js Github

copy

Full Screen

...73 //组装显示节点的父节点的父节点....直到根节点,并展示74 getParentShowNodes_ztree(treeId, highlightNodes[i],showNodes);75 }76 treeObj.hideNodes(allNodes)77 treeObj.showNodes(showNodes);78 treeObj.expandAll(true);79 }80 }else if (type == "vehicle"){81 treeObj.hideNodes(allNodes)82 treeObj.showNodes(highlightNodes);83 treeObj.expandAll(true);84 }else{85 //<2>.得到模糊匹配搜索条件的节点数组集合86// treeObj.hideNodes(allNodes);87// treeObj.showNodes(highlightNodes);88// treeObj.expandAll(true);89 // 需要显示是节点(包含父节点)90 var showNodes = [];91 // 只显示直接上级92 if (highlightNodes != null) {93 for (var i = 0; i < highlightNodes.length; i++) {94 //组装显示节点的父节点的父节点....直到根节点,并展示95 getParentShowNodes_ztree(treeId, highlightNodes[i],showNodes);96 }97 treeObj.hideNodes(allNodes)98 treeObj.showNodes(showNodes);99 treeObj.expandAll(true);100 }101 }102 }else{103 treeObj.showNodes(allNodes)104 treeObj.expandAll(true);105 }106 //<3>.高亮显示并展示【指定节点s】107 // highlightAndExpand_ztree(treeId, highlightNodes, flag);108}109110function realTimeMonitoringFilter(node){ // 模糊搜索从业人员,终端编号111 return (node.type == "station" && node.name.indexOf(searchParam) > -1) || 112 (node.type == "people" && node.name.indexOf(searchParam) > -1) ||113 (node.professional != undefined && node.professional != null && node.professional.indexOf(searchParam) > -1) ||114 (node.simcardNumber != undefined && node.simcardNumber != null && node.simcardNumber.indexOf(searchParam) > -1) || 115 (node.assignName != undefined && node.assignName != null && node.assignName.indexOf(searchParam) > -1) || 116 (node.deviceNumber != undefined && node.deviceNumber != null && node.deviceNumber.indexOf(searchParam) > -1)117}118119function monitorFilter(node){ // 搜索type等于人或者车120 return node.type == "station" || node.type == "people" 121}122123function monitorParamFuzzyFilter(node){ // 模糊匹配name,type等于人或者车124 return (node.type == "station" && node.name.indexOf(searchParam) > -1) || (node.type == "people" && node.name.indexOf(searchParam) > -1)125}126127/**128 * 搜索没有展开的分组节点129 * @param node130 * @returns131 */132function assignmentNotExpandFilter(node){ // 搜索type等于人或者车133 return node.type == "assignment" && node.children != undefined && node.children.length >0 && node.children[0].open==false;134}135136/**137 * 搜索所有的对象138 * @param node139 * @returns140 */141function moniterFilter(node){ // 搜索type等于人或者车142 return (node.type == "station" || node.type == "people")&&node.isHidden===false;143}144145/**146 * 搜索树,高亮显示并展示【模糊匹配搜索条件的节点s】147 * @param treeId148 * @param searchConditionId 搜索条件Id149 * @param flag 需要高亮显示的节点标识150 */151function high_search_ztree(treeId, searchConditionId,hasBegun) {152 //<1>.搜索条件153 var searchCondition = $('#' + searchConditionId).val();154 var highlightNodes = [];155// var allNodes = [];156 var treeObj = $.fn.zTree.getZTreeObj(treeId);157 searchParam = searchCondition;158 highlightNodes = treeObj.getNodesByFilter(realTimeMonitoringFilter); 159 // allNodes = treeObj.getNodesByFilter(monitorFilter); // 所有type型nodes160 var allNodes = treeObj.transformToArray(treeObj.getNodes()); // 所有节点161 if (searchCondition != "") {162 //<2>.得到模糊匹配搜索条件的节点数组集合163 // 需要显示是节点(包含父节点)164 var showNodes = [];165 // 只显示直接上级166 if (highlightNodes != null) {167 for (var i = 0; i < highlightNodes.length; i++) {168 //组装显示节点的父节点的父节点....直到根节点,并展示169 if(hasBegun.indexOf(highlightNodes[i].getParentNode().id)==-1){170 hasBegun.push(highlightNodes[i].getParentNode().id)171 treeObj.expandNode(highlightNodes[i].getParentNode(), true, true, false, true);172 }173 getParentShowNodes_ztree(treeId, highlightNodes[i],showNodes);174 }175176 treeObj.hideNodes(allNodes)177 treeObj.showNodes(showNodes);178 // treeObj.expandAll(true);179 }180 }else{181 // var allNodes1 = treeObj.transformToArray(treeObj.getNodes()); // 所有节点182// treeObj.hideNodes(allNodes)183 treeObj.showNodes(allNodes)184 treeObj.expandAll(true);185 }186 //<3>.高亮显示并展示【指定节点s】187 // highlightAndExpand_ztree(treeId, highlightNodes, flag);188}189190function searchTypeFilter(node){ // 模糊搜索从业人员,终端编号191 var value = node[''+searchTypeValue+''];192 return ((node.type == "station" || node.type == "people") && value != undefined && value != null && value.indexOf(searchParam) > -1)193}194195/**196 * 搜索树,根据搜索类型模糊匹配197 * @param treeId198 * @param searchConditionId 搜索条件Id199 * @param searchType 搜索条件type200 * @param flag 需要高亮显示的节点标识201 */202function search_ztree_by_search_type(treeId, searchConditionId,searchType,hasBegun) {203 //<1>.搜索条件204 var searchCondition = $('#' + searchConditionId).val();205 var highlightNodes = [];206 var treeObj = $.fn.zTree.getZTreeObj(treeId);207 searchParam = searchCondition;208 searchTypeValue = searchType;209 //highlightNodes = treeObj.getNodesByFilter(searchTypeFilter); 210 // highlightNodes = treeObj.getNodesByParamFuzzy(searchType, searchCondition, null);211 var allNodes = treeObj.transformToArray(treeObj.getNodes()); // 所有节点212 if (searchCondition != "") {213 //<2>.得到模糊匹配搜索条件的节点数组集合214 // 需要显示是节点(包含父节点) 215 var showNodes = [];216 // 只显示直接上级217 if (allNodes != null) {218 for (var i = 0; i < allNodes.length; i++) {219 var node = allNodes[i];220 var value = node[''+searchType+''];221 if ((node.type == "station" || node.type == "people") && value != undefined && value != null && value.indexOf(searchParam) > -1) {222 //highlightNodes.push(node);223 //组装显示节点的父节点的父节点....直到根节点,并展示224 if(hasBegun.indexOf(node.getParentNode().id)==-1){225 hasBegun.push(node.getParentNode().id)226 treeObj.expandNode(node.getParentNode(), true, true, false, true);227 }228 getParentShowNodes_ztree(treeId, node,showNodes);229 }230 }231 treeObj.hideNodes(allNodes)232 treeObj.showNodes(showNodes);233 }234 235 /*if (highlightNodes != null) {236 for (var i = 0; i < highlightNodes.length; i++) {237 //组装显示节点的父节点的父节点....直到根节点,并展示238 if(hasBegun.indexOf(highlightNodes[i].getParentNode().id)==-1){239 hasBegun.push(highlightNodes[i].getParentNode().id)240 treeObj.expandNode(highlightNodes[i].getParentNode(), true, true, false, true);241 }242 getParentShowNodes_ztree(treeId, highlightNodes[i],showNodes);243 }244245 treeObj.hideNodes(allNodes)246 treeObj.showNodes(showNodes);247 }*/248 }else{249 treeObj.showNodes(allNodes)250 treeObj.expandAll(true);251 }252}253254function showSearchNodes(treeId, checkedList) {255 var treeObj = $.fn.zTree.getZTreeObj(treeId);256 var allNodes = treeObj.transformToArray(treeObj.getNodes()); // 所有节点257 //<2>.得到模糊匹配搜索条件的节点数组集合258 // 需要显示是节点(包含父节点) 259 var showNodes = [];260 var checkedNodes = [];261 // 只显示直接上级262 if (allNodes !== null) {263 for (var i = 0; i < allNodes.length; i++) {264 var node = allNodes[i];265// var value = node[''+searchType+''];266 if ((node.type === "station" || node.type === "people") ) {267 // 勾选搜索前勾选的车辆268 if (checkedList !== null && checkedList !== undefined && checkedList.length > 0269 && checkedList.indexOf(node.id) !== -1){270 treeObj.checkNode(node, true, true);271 }272 //组装显示节点的父节点的父节点....直到根节点,并展示273 if (checkedNodes.indexOf(node.pId) >= 0) {274 showNodes.push(node);275 continue;276 }277 checkedNodes.push(node.pId);278 treeObj.expandNode(node.getParentNode(), true, true, false, true);279 getParentShowNodes_ztree(treeId, node, showNodes);280 }281 }282 treeObj.hideNodes(allNodes);283 treeObj.showNodes(showNodes);284 }285}286287function filterQueryResult(data, checkedList) {288 if (data === null) {289 return;290 }291292 if (checkedList === undefined || checkedList === null) {293 checkedList = [];294 }295296 // 初始化节点为hashMap297 var nodes = {}; ...

Full Screen

Full Screen

MtrSearchZTree.js

Source:MtrSearchZTree.js Github

copy

Full Screen

...55 findParent(ztreeObj, showNodes[n],showNodes);56 }57 }58 //显示匹配的节点,注意:使用showNodes()方法时需要引包jquery.ztree.exhide-3.5.min.js59 ztreeObj.showNodes(showNodes);60 //把当前显示的的元素保存61 showNodesAll[id] = showNodes;62 }else{63 //显示所有节点64 ztreeObj.showNodes(nodesAll[id]);65 //折叠所有节点66 ztreeObj.expandAll(false);67 }68 });69 }70 71 function setAllNodes(id){72 //保存全部节点73 var ztreeObj = $.fn.zTree.getZTreeObj(id);74 var nodes = ztreeObj.getNodes();75 nodesAll[id] = ztreeObj.transformToArray(nodes);76 //初始为空77 showNodesAll[id] = [];78 }79 80 function initSearchZTree(){81 var ztrees = $(location);82 for(let i = 0; i < ztrees.length; i++){83 var ztree = ztrees.eq(i);84 var ztreeId = ztree.attr("id");85 //删除原有的输入框86 ztree.children("input").remove();87 //插入input输入框88 var html = '<input id="'+ztreeId+'Keyword" type="text" class="form-control" placeholder="请输入关键字...">';89 ztree.prepend(html);90 //初始化节点保存91 setAllNodes(ztreeId);92 //绑定事件93 bindingZTree(ztreeId);94 }95 }96 97 //初始化98 initSearchZTree();99 100 return {101 getshowNodesById : function(id){102 if(id){103 return showNodesAll[id];104 }105 },106 getshowNodes(){107 return showNodesAll;108 }109 } ...

Full Screen

Full Screen

ReDefineTableViewRender.ts

Source:ReDefineTableViewRender.ts Github

copy

Full Screen

1import * as cc from 'cc';2import { TableViewCell} from "./TableViewCell"3const { ccclass, property} = cc._decorator;4@ccclass('ReDefineTableViewRender')5export class ReDefineTableViewRender extends cc.Renderable2D {6 private m_tableView : any = null;7 8 onEnable()9 {10 if(this.m_tableView == null) return;11 let shownodes : Map<number, TableViewCell> = this.m_tableView.m_showNodes;12 let freeNodes : TableViewCell [] = this.m_tableView.m_freeNodes;13 if(shownodes)14 {15 shownodes.forEach(( cell : TableViewCell)=>{16 cell.__redefineInit();17 })18 }19 if(freeNodes)20 {21 freeNodes.forEach(( cell : TableViewCell)=>{22 cell.__redefineInit();23 })24 }25 }26 onDisable()27 {28 if(this.m_tableView == null) return;29 let shownodes : Map<number, TableViewCell> = this.m_tableView.m_showNodes;30 let freeNodes : TableViewCell [] = this.m_tableView.m_freeNodes;31 if(shownodes)32 {33 shownodes.forEach(( cell : TableViewCell)=>{34 cell.___redefineReset();35 })36 }37 if(freeNodes)38 {39 freeNodes.forEach(( cell : TableViewCell)=>{40 cell.___redefineReset()41 })42 }43 }44 public setTableView( tableview : any )45 {46 this.m_tableView = tableview;47 }48 public updateAssembler (batcher: any) {49 50 }51 public postUpdateAssembler (batcher: any) {52 let shownodes : Map<number, TableViewCell> = this.m_tableView.m_showNodes;53 if(shownodes == null || shownodes.size <= 0) return;54 let isfinish = false;55 for(let level = 0;; level++)56 {57 if(isfinish) break;58 shownodes.forEach(( cell : TableViewCell)=>{59 if(!cell.__renderUI(level, batcher)){60 isfinish = true;61 }62 })63 }64 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var tree = new WPTree();2var tree2 = new WPTree();3var tree3 = new WPTree();4var tree4 = new WPTree();5var tree5 = new WPTree();6var tree6 = new WPTree();7var tree7 = new WPTree();8var tree8 = new WPTree();9var tree9 = new WPTree();10var tree10 = new WPTree();11var tree11 = new WPTree();12var tree12 = new WPTree();13var tree13 = new WPTree();14var tree14 = new WPTree();15var tree15 = new WPTree();16var tree16 = new WPTree();17var tree17 = new WPTree();18var tree18 = new WPTree();19var tree19 = new WPTree();20var tree20 = new WPTree();21var tree21 = new WPTree();22var tree22 = new WPTree();23var tree23 = new WPTree();24var tree24 = new WPTree();25var tree25 = new WPTree();26var tree26 = new WPTree();27var tree27 = new WPTree();28var tree28 = new WPTree();29var tree29 = new WPTree();30var tree30 = new WPTree();31var tree31 = new WPTree();32var tree32 = new WPTree();33var tree33 = new WPTree();34var tree34 = new WPTree();35var tree35 = new WPTree();36var tree36 = new WPTree();37var tree37 = new WPTree();38var tree38 = new WPTree();39var tree39 = new WPTree();40var tree40 = new WPTree();41var tree41 = new WPTree();42var tree42 = new WPTree();43var tree43 = new WPTree();44var tree44 = new WPTree();45var tree45 = new WPTree();46var tree46 = new WPTree();47var tree47 = new WPTree();48var tree48 = new WPTree();49var tree49 = new WPTree();50var tree50 = new WPTree();51var tree51 = new WPTree();52var tree52 = new WPTree();53var tree53 = new WPTree();54var tree54 = new WPTree();55var tree55 = new WPTree();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptree = require('wptree');2const tree = new wptree();3tree.insert(5);4tree.insert(3);5tree.insert(7);6tree.insert(2);7tree.insert(4);8tree.insert(6);9tree.insert(8);10tree.insert(1);11tree.insert(9);12tree.insert(10);13tree.showNodes();14### insert(value)15### contains(value)16### remove(value)17### size()18### toArray()19### toString()20### showNodes()

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptree = require('./wptree');2var tree = new wptree();3tree.add(5);4tree.add(3);5tree.add(7);6tree.add(2);7tree.add(4);8tree.add(6);9tree.add(8);10tree.add(1);11tree.add(9);12tree.add(10);13tree.showNodes();

Full Screen

Using AI Code Generation

copy

Full Screen

1var WPTree = require('./wptree.js');2var fs = require('fs');3var data = fs.readFileSync('data.json');4var data = JSON.parse(data);5var wptree = new WPTree(data);6wptree.showNodes();7var WPTree = require('wptree');8var wptree = new WPTree(data);9#### showNodes()10wptree.showNodes();11#### getNodes()12var nodes = wptree.getNodes();13#### getRootNode()14var rootNode = wptree.getRootNode();15#### getChildrenOfNode(node)16var children = wptree.getChildrenOfNode(node);17#### getParentOfNode(node)18var parent = wptree.getParentOfNode(node);19#### getDepthOfNode(node)20var depth = wptree.getDepthOfNode(node);21#### getDepthOfTree()22var depth = wptree.getDepthOfTree();23#### getNumberOfNodes()24var numberOfNodes = wptree.getNumberOfNodes();25#### getNumberOfChildrenOfNode(node)26var numberOfChildren = wptree.getNumberOfChildrenOfNode(node);27#### getNumberOfChildrenOfTree()28var numberOfChildren = wptree.getNumberOfChildrenOfTree();29#### getNumberOfParentsOfNode(node)30var numberOfParents = wptree.getNumberOfParentsOfNode(node);31#### getNumberOfParentsOfTree()32var numberOfParents = wptree.getNumberOfParentsOfTree();33#### getNumberOfLeaves()34var numberOfLeaves = wptree.getNumberOfLeaves();

Full Screen

Using AI Code Generation

copy

Full Screen

1var WPTree = require('./wptree.js');2var tree = new WPTree("root");3tree.addNode("root", "node1");4tree.addNode("root", "node2");5tree.addNode("node1", "node11");6tree.addNode("node1", "node12");7tree.addNode("node2", "node21");8tree.addNode("node2", "node22");9tree.addNode("node12", "node121");10tree.addNode("node12", "node122");11tree.addNode("node12", "node123");12tree.addNode("node122", "node1221");13tree.addNode("node122", "node1222");14tree.addNode("node122", "node1223");15var nodes = tree.showNodes("node1");16console.log(nodes);17var nodes = tree.showNodes("node2");18console.log(nodes);19var nodes = tree.showNodes("node122");20console.log(nodes);21var nodes = tree.showNodes("node1222");22console.log(nodes);23var nodes = tree.showNodes("root");24console.log(nodes);25var WPTree = require('./wptree.js');26var tree = new WPTree("root");27tree.addNode("root", "node1");28tree.addNode("root", "node2");29tree.addNode("node1", "node11");30tree.addNode("node1", "node12");31tree.addNode("node2", "node21");32tree.addNode("node2", "node22");33tree.addNode("node12", "node121");34tree.addNode("node12", "node122");35tree.addNode("node12", "node123");36tree.addNode("node122", "node1221");37tree.addNode("node122", "node1222");38tree.addNode("node122", "node1223");39var nodes = tree.showNodes("node1");40console.log(nodes);41var nodes = tree.showNodes("node2");42console.log(nodes);43var nodes = tree.showNodes("node122");44console.log(nodes);45var nodes = tree.showNodes("node1222");46console.log(nodes);47var nodes = tree.showNodes("root");48console.log(nodes);49var WPTree = require('./wptree.js');50var tree = new WPTree("root");51tree.addNode("root", "node1");52tree.addNode("root", "node2");53tree.addNode("node

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptree = require('./wptree.js');2var tree = new wptree();3var fs = require('fs');4var file = fs.readFileSync('data.txt', 'utf8');5var lines = file.split('\n');6for (var i = 0; i < lines.length; i++) {7 var line = lines[i];8 var parts = line.split(' ');9 var cmd = parts[0];10 var arg = parts[1];11 switch (cmd) {12 tree.add(arg);13 break;14 tree.remove(arg);15 break;16 tree.showNodes();17 break;18 console.log(tree.find(arg));19 break;20 console.log(tree.findMin());21 break;22 console.log(tree.findMax());23 break;24 console.log(tree.count());25 break;26 console.log(tree.height());27 break;28 tree.clear();29 break;30 console.log('unknown command: ' + cmd);31 break;32 }33}

Full Screen

Using AI Code Generation

copy

Full Screen

1var myTree = new wptree();2var myTable = new table();3var myRow = new row();4var myCell = new cell();5var myText = new text();6var myButton = new button();7var myDiv = new div();8var myInput = new input();9var myForm = new form();10var mySelect = new select();11var myOption = new option();12var myForm = new form();13var myDiv = new div();14var mySelect = new select();15var myOption = new option();16var myForm = new form();17var myDiv = new div();18var mySelect = new select();19var myOption = new option();20var myForm = new form();21var myDiv = new div();22var mySelect = new select();23var myOption = new option();24var myForm = new form();25var myDiv = new div();26var mySelect = new select();27var myOption = new option();28var myForm = new form();29var myDiv = new div();30var mySelect = new select();31var myOption = new option();32var myForm = new form();33var myDiv = new div();34var mySelect = new select();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful