diff --git a/bi/core.js b/bi/core.js index af4d547e4..7d6a75020 100644 --- a/bi/core.js +++ b/bi/core.js @@ -10403,6 +10403,19 @@ $.extend(BI, { } else { return [sNodes]; } + }, + + traversal: function (array, callback) { + if (BI.isNull(array)) { + return; + } + var self = this; + BI.any(array, function (i, item) { + if (callback(i, item) === false) { + return true; + } + self.traversal(item.children, callback); + }) } }) })();//向量操作 diff --git a/docs/core.js b/docs/core.js index e1ec3a400..14ffbdf52 100644 --- a/docs/core.js +++ b/docs/core.js @@ -18862,6 +18862,19 @@ $.extend(BI, { } else { return [sNodes]; } + }, + + traversal: function (array, callback) { + if (BI.isNull(array)) { + return; + } + var self = this; + BI.any(array, function (i, item) { + if (callback(i, item) === false) { + return true; + } + self.traversal(item.children, callback); + }) } }) })();//向量操作 diff --git a/src/core/utils/tree.js b/src/core/utils/tree.js index 51ac0f23b..139dedce1 100644 --- a/src/core/utils/tree.js +++ b/src/core/utils/tree.js @@ -464,6 +464,19 @@ } else { return [sNodes]; } + }, + + traversal: function (array, callback) { + if (BI.isNull(array)) { + return; + } + var self = this; + BI.any(array, function (i, item) { + if (callback(i, item) === false) { + return true; + } + self.traversal(item.children, callback); + }) } }) })(); \ No newline at end of file