$.fn.extend({ ztreeSearch : function(options) {// var _self=$(this); var defaults = { id : '', searchText :'', setting : {} }; options = $.extend(defaults,options); var _object = $("#" + options.id); var allNodes =$(".ztreeSearch").data("data"); $.fn.zTree.init( _object, options.setting, allNodes); var ztree = $.fn.zTree.getZTreeObj(options.id); var nodes = ztree.getNodesByParamFuzzy("name", options.searchText, null);// 模糊搜索 var newNodes = new Array(); for(var i=0;i