EasyUI checkbox tree onChecked 이벤트 처리
<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>