Jquery LigerUI架構學習(一)Tree資料整理

來源:互聯網
上載者:User

標籤: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資料整理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.