MCPcopy Create free account
hub / github.com/ElemeFE/element-react / expand

Method expand

src/tree/model/node.js:211–233  ·  view source on GitHub ↗
(callback, expandParent)

Source from the content-addressed store, hash-verified

209 }
210
211 expand(callback, expandParent) {
212 const done = () => {
213 if (expandParent) {
214 let parent = this.parent;
215 while (parent.level > 0) {
216 parent.expanded = true;
217 parent = parent.parent;
218 }
219 }
220 this.expanded = true;
221 if (callback) callback();
222 };
223
224 if (this.shouldLoadData()) {
225 this.loadData((data) => {
226 if (data instanceof Array) {
227 done();
228 }
229 });
230 } else {
231 done();
232 }
233 }
234
235 doCreateChildren(array, defaultProps = {}) {
236 array.forEach((item) => {

Callers 4

constructorMethod · 0.95
handleExpandIconClickMethod · 0.80
traverseMethod · 0.80

Calls 2

shouldLoadDataMethod · 0.95
loadDataMethod · 0.95

Tested by

no test coverage detected