0

好的,这很奇怪......我有相同的代码,可以在 if 语句中很好地工作......但是一旦它到达parentsUntilelse 语句时就不会触发????

 if(sArray.length > 400){

 $.each(sArray,  function(key, item){

                    $("!#"+item).parentsUntil(".#jstree").filter(".#jstree-closed").each(function () { 
                            $aTree.jstree("close_all", this); 
                            }); 
                  });

else{

 $.each(sArray,  function(key, item){

                    $("!#"+item).parentsUntil(".#jstree").filter(".#jstree-closed").each(function () { 
//IT IS NOT MAKING IT HERE
                            $aTree.jstree("close_all", this); 
                            }); 
                  });


}
4

1 回答 1

1

您错过了 2 } 以及控制台为您提供的内容:

if(sArray.length > 400){

     $.each(sArray,  function(key, item){
        $("#"+item).parentsUntil(".jstree").filter(".jstree-closed").each(function () { 
            $aTree.jstree("check_node", this); 
        }); 
    });

}// Was missing
else{

$.each(sArray,  function(key, item){
    console.log($("#"+item).parentsUntil(".jstree").filter(".jstree-closed"));
    $("#"+item).parentsUntil(".jstree").filter(".jstree-closed").each(function () { 
            //IT IS NOT MAKING IT HERE
            console.log("pass");
            $aTree.jstree("check_node", this); 
        }); 
    });
}
于 2013-08-30T14:33:39.813 回答