<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title id="page-title">Extjs4</title>
	<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css">
	<script type="text/javascript" src="ext-all.js"></script>
	<script type="text/javascript">
	Ext.onReady(function(){
	
		/////////////////////////////////////////////////////////
		// 1. get : id 검색 
		/////////////////////////////////////////////////////////
		var myCompany = Ext.get('department') ; 
		console.log("Loading ID : " + myCompany.id ) ; 
		// 출력 : Loading ID : department 
		
		
		
		/////////////////////////////////////////////////////////
		// 2. query : 검색 된 모든 요소 리턴
		/////////////////////////////////////////////////////////
		var branchesQuery = Ext.query('ul#branches li'); 
		console.log( branchesQuery ) ; 
		
		
		
		/////////////////////////////////////////////////////////
		// 3. select : 검색 된 모든 요소 리턴
		// #은 id임. 
		/////////////////////////////////////////////////////////
		var branchesSelect = Ext.select('ul#branches li'); 
		console.log( branchesSelect ) ; 
		
		
		
		/////////////////////////////////////////////////////////
		// 3.1 select item : 검색된 요소 중 특정 item 만 리턴
		/////////////////////////////////////////////////////////
		var branchesSelectItem = Ext.select('ul#branches li').item(2); 
		console.log( branchesSelectItem.dom.innerHTML ) ; 
		// 출력 : USA
		
		
		
		/////////////////////////////////////////////////////////
		// 4. prev : 이전 요소
		/////////////////////////////////////////////////////////
		console.log( branchesSelectItem.prev().dom.innerHTML ) ; 
		// 출력 : india
		
		
		
		/////////////////////////////////////////////////////////
		// 5. next : 다음 요소
		/////////////////////////////////////////////////////////
		console.log( branchesSelectItem.next().dom.innerHTML ) ; 
		// 출력 : China
		
		
		
		/////////////////////////////////////////////////////////
		// 6. parent : 부모 선택
		/////////////////////////////////////////////////////////
		console.log( branchesSelectItem.parent().id ) ; 
		// 출력 : branches
		
		
		
		/////////////////////////////////////////////////////////
		// 6. child : 자식 선택 
		/////////////////////////////////////////////////////////
		var branchesEl = Ext.get('branches') ; 
		
		
		
		/////////////////////////////////////////////////////////
		// 6.1 child : 가장 첫 번째 자식
		/////////////////////////////////////////////////////////
		var firstChildEl = branchesEl.child('li') ; 
		console.log( firstChildEl.dom.innerHTML ) ; 
		// 출력 : Singapore 
		
		
		
		/////////////////////////////////////////////////////////
		// 6.2 first : 가장 첫 번째 자식 
		/////////////////////////////////////////////////////////
		var firstChildEl = branchesEl.child('li') ; 
		console.log( branchesEl.first().dom.innerHTML ) ; 
		// 출력 : Singapore 
		
		
		
		/////////////////////////////////////////////////////////
		// 6.3 last : 가장 마지막 번째 자식 
		/////////////////////////////////////////////////////////
		var firstChildEl = branchesEl.child('li') ; 
		console.log( branchesEl.last().dom.innerHTML ) ; 
		// 출력 : China 
		
		
		
	}); 
	</script>   
	
</head>
<body>
	
	<div id="department">
		department
	</div>
	
	<ul id="branches">
		<li>Singapore</li>
		<li>india</li>
		<li>USA</li>
		<li>China</li>
	</ul>
	
	
</body>
</html> 
블로그 이미지

나무뚱이

,