Sencah treepanel에서 1 depth까지만 펼치기

2024. 12. 8. 14:11Javascript/Sencha

getPath()를 통해서 원하는 depth를 설정하고, expand() 처리를 함

success: function (response) {
	const data = Ext.decode(response.responseText);
	const treeData = buildTree(data);
	store.setRoot({
		id: 0,
		expanded: true,
		children: treeData
	});

	const rootNode = store.getRootNode();
	const treeGrid = Ext.ComponentQuery.query('#location')[0];
	treeGrid.getSelectionModel().select(rootNode);
	//treeGrid.expandAll();
	rootNode.eachChild(function(childNode) {
		if(childNode.getDepth() == 1) {
			childNode.expand();
		}	
	});
},