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

Method setChecked

src/tree/model/node.js:262–293  ·  view source on GitHub ↗
(value, deep)

Source from the content-addressed store, hash-verified

260 }
261
262 setChecked(value, deep) {
263 this.indeterminate = value === 'half';
264 this.checked = value === true;
265
266 const handleDescendants = () => {
267 if (deep) {
268 const childNodes = this.childNodes;
269 for (let i = 0, j = childNodes.length; i < j; i++) {
270 const child = childNodes[i];
271 child.setChecked(value !== false, deep);
272 }
273 }
274 };
275
276 if (!this.store.checkStrictly && this.shouldLoadData()) {
277 // Only work on lazy load data.
278 this.loadData(() => {
279 handleDescendants();
280 }, {
281 checked: value !== false
282 });
283 } else {
284 handleDescendants();
285 }
286
287 const parent = this.parent;
288 if (!parent || parent.level === 0) return;
289
290 if (!this.store.checkStrictly) {
291 reInitChecked(parent);
292 }
293 }
294
295 getChildren() { // this is data
296 const data = this.data;

Callers 2

reInitCheckedFunction · 0.45
handleDescendantsMethod · 0.45

Calls 3

shouldLoadDataMethod · 0.95
loadDataMethod · 0.95
reInitCheckedFunction · 0.85

Tested by

no test coverage detected