<html>
<head></head>
<body>
<ul id="tt"></ul>
</body>
</html>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<script>
var isLoadingTime = true;
$(document).ready(function() {
$('#tt').tree({
data : [{
"id" : 1,
"text" : "Folder1",
"iconCls" : "icon-save",
"children" : [{
"text" : "File1",
"checked" : true,
"attributes" : {
"url" : "File1 111",
"price" : 100
}
}, {
"text" : "Books",
"state" : "open",
"attributes" : {
"url" : "Books 222",
"price" : 100
},
"children" : [{
"text" : "PhotoShop",
"checked" : true,
"attributes" : {
"url" : "PhotoShop 333",
"price" : 100
}
}, {
"id" : 8,
"text" : "Sub Bookds",
"state" : "closed",
"attributes" : {
"url" : "Sub Bookds 444",
"price" : 100
}
}]
}]
}, {
"text" : "Languages",
"state" : "closed",
"children" : [{
"text" : "Java",
"attributes" : {
"url" : "Java 555",
"price" : 100
}
}, {
"text" : "C#",
"attributes" : {
"url" : "C# 666",
"price" : 100
}
}]
}],
checkbox : true,
onCheck : function(node, checked) {
if (isLoadingTime) {
return;
}
var arrayLayerName = [];
var nodes = $('#tt').tree('getChecked');
$(nodes).each(function() {
if (this.attributes && this.attributes.url) {
arrayLayerName.push(this.attributes.url);
}
});
//alert(nodes.toString());
alert(arrayLayerName);
}
});
isLoadingTime = false;
});
</script>
'프로그래밍 TIP > JAVASCRIPT' 카테고리의 다른 글
[서적 핵심 정리] 자바스크립트 객체지향 프로그래밍 (2) | 2014.05.14 |
---|---|
[JSON] easyUI checkbox tree 만들기 (2) | 2013.10.23 |
SelectBox 순서 조절하기 (2) | 2013.10.09 |
[JAVASCRIPT] 사랑 가능성 테스트 최종본 (0) | 2013.05.25 |
[JAVAScript] 사랑 가능성 테스트 중간본 (0) | 2013.05.24 |