From 517ca63f00083e01007d2c30baddd03608ec0dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=A4=E8=91=A3?= <6515563+kun_dong@user.noreply.gitee.com> Date: Thu, 27 Aug 2020 18:02:18 +0800 Subject: [PATCH] =?UTF-8?q?update=20demo/js/fuzzysearch.js.=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=89=8D=EF=BC=9A=E4=BD=BF=E7=94=A8=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=A0=91=E7=9A=84=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=90=9C=E7=B4=A2=E6=9C=89=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E8=8A=82=E7=82=B9=E6=97=B6=EF=BC=8C=E6=90=9C?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E4=B9=8B=E5=90=8E=E5=85=B6=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E4=B8=8D=E6=98=BE=E7=A4=BA=E3=80=82=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8E=EF=BC=9A=E5=BD=93=E6=90=9C=E7=B4=A2=E6=9C=89?= =?UTF-8?q?=E5=AD=90=E8=8A=82=E7=82=B9=E7=9A=84=E8=8A=82=E7=82=B9=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=97=B6=E5=B0=86=E5=85=B6=E5=AD=90=E5=AD=99?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=85=A8=E9=83=A8=E6=98=BE=E7=A4=BA=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/fuzzysearch.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/demo/js/fuzzysearch.js b/demo/js/fuzzysearch.js index bc2a603..96dc0e7 100644 --- a/demo/js/fuzzysearch.js +++ b/demo/js/fuzzysearch.js @@ -93,6 +93,12 @@ zTreeObj.expandNode(pathOfOne[i],true); //expand node } } + if(obj.children){ + var NodesMaps = new Map(); + var objs = obj.children; + NodesMaps.set(0,objs); + showChildrenNodes(NodesMaps); + } }); }else{ //show all nodes when _keywords is blank and expand the root nodes var rootNodes = zTreeObj.getNodesByParam('level','0');//get all root nodes @@ -102,7 +108,26 @@ } } } - + function showChildrenNodes(NodesMaps){ + var NodesMap = new Map(); + var i=0; + NodesMaps.forEach(function(value,key,map){ + if(value && value.length>0){ + $.each(value, function(n,node){ + zTreeObj.showNode(node); //show node + zTreeObj.expandNode(node,true); //expand node + if(node.children){ + var objs = node.children; + NodesMap.set(i,objs); + i++; + } + }); + } + }); + if(NodesMap != null&&NodesMap.size > 0){ + showChildrenNodes(NodesMap); + } + } //listen to change in input element $(searchField).bind('input propertychange', function() { var _keywords = $(this).val(); -- Gitee