標籤:style blog http color os java 使用 io for
<html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script> <link href="lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> <script src="lib/ligerUI/js/core/base.js" type="text/javascript"></script> <script src="lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script> <style type="text/css"> .box { float: left; } .tree { width: 230px; height: 200px; margin: 10px; border: 1px solid #ccc; overflow: auto; } h4 { margin: 10px; } </style> <script type="text/javascript"> var manager=null; $(function () { $("#tree1").ligerTree({ nodeWidth: 200, //Tree控制項寬度 data: createData(), //Tree資料來源 checkbox: true, //是否使用Checkbox idFieldName: ‘id‘, //綁定id isExpand: 2, //是否展開節點 FALSE為不展開 TRUE展示所有節點 指定數字為展開指定節點 slide: false, //節點展開效果False無效果 TRUE緩慢展開效果 parentIDFieldName: ‘pid‘//綁定夫ID }); manager = $("#tree1").ligerGetTreeManager(); }); //資料輸出 function createData() { var data = []; data.push({ id: 1, pid: 0, text: ‘1‘, url: "www.baidu.com",ischecked: true});//設定節點ID 夫ID 節點內容 節點連結 選中狀態 data.push({ id: 2, pid: 1, text: ‘1.1‘ }); data.push({ id: 4, pid: 2, text: ‘1.1.2‘ }); data.push({ id: 5, pid: 2, text: ‘1.1.2‘ }); data.push({ id: 10, pid: 8, text: ‘wefwfwfe‘ }); data.push({ id: 11, pid: 8, text: ‘wgegwgwg‘ }); data.push({ id: 12, pid: 8, text: ‘gwegwg‘ }); data.push({ id: 6, pid: 2, text: ‘1.1.3‘, ischecked: true }); data.push({ id: 7, pid: 2, text: ‘1.1.4‘ }); data.push({ id: 8, pid: 7, text: ‘1.1.5‘ }); data.push({ id: 9, pid: 7, text: ‘1.1.6‘ }); data.push({ id: 20, pid: 0, text: ‘1‘, url: "www.baidu.com" }); data.push({ id: 21, pid: 20, text: ‘12‘, url: "www.baidu.com" }); return data; } function getSelected() { var note = manager.getSelected(); //擷取選中節點的內容 非選中chechbox alert(‘選擇的是:‘ + note.data.url); } function getChecked() { var notes = manager.getChecked(); //擷取選中Chechebox內容 var text = ""; for (var i = 0; i < notes.length; i++) { text += notes[i].data.text + ","; } alert(‘選擇的節點數:‘ + text); } function collapseAll() { manager.collapseAll();//全選 } function expandAll() { manager.expandAll();//取消全選 } </script></head><body style="padding: 10px"><input value="全選" onclick="collapseAll()" type="button" /><input value="取消全選" onclick="collapseAll()" type="button" /><input value="擷取選中內容" onclick="getSelected()" type="button" /><input value="擷取選中Chechebox內容" onclick="getChecked()" type="button" /> <div class="box"> <h4> 不展開節點</h4> <div class="tree"> <ul id="tree1"> </ul> </div> </div> <div class="l-clear"> </div></body></html>View Code
Jquery LigerUI架構學習(一)Tree資料整理